Compare commits
2 commits
main
...
greenkeepe
Author | SHA1 | Date | |
---|---|---|---|
![]() |
772d837461 | ||
![]() |
c255fd39dd |
2
.deployment
Normal file
|
@ -0,0 +1,2 @@
|
|||
[config]
|
||||
command = deploy.cmd
|
|
@ -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
|
@ -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
|
@ -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
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
|
||||
---
|
||||
|
||||
|
17
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal 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
|
@ -0,0 +1,2 @@
|
|||
**Description**
|
||||
A clear and concise description of what the requirement is.
|
16
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal 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
|
@ -0,0 +1,3 @@
|
|||
isOutside: true
|
||||
# Team Name
|
||||
team: contributors
|
44
.github/settings.yml
vendored
Normal 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
|
23
.gitignore
vendored
|
@ -11,24 +11,7 @@
|
|||
/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
|
||||
/tmp
|
||||
/work
|
||||
*.vbs.compiled
|
||||
*.vbs.js
|
||||
*.vbs.ts
|
||||
.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*
|
||||
/packages/default.gbdialog/bot.js
|
||||
/packages/default.gbdialog/bot.ts
|
||||
|
|
9
.hintrc
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"extends": [
|
||||
"development"
|
||||
],
|
||||
"hints": {
|
||||
"typescript-config/strict": "off",
|
||||
"typescript-config/consistent-casing": "off"
|
||||
}
|
||||
}
|
30
.nycrc
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"check-coverage": true,
|
||||
"statements": 0,
|
||||
"lines": 0,
|
||||
"functions": 0,
|
||||
"branches": 0,
|
||||
"watermarks": {
|
||||
"statements": [0, 0],
|
||||
"lines": [0, 0],
|
||||
"functions": [0, 0],
|
||||
"branches": [0, 0]
|
||||
},
|
||||
"cache": true,
|
||||
"extension": [
|
||||
".ts"
|
||||
],
|
||||
"include": [
|
||||
"packages/**"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**/*",
|
||||
"**/tests/**/*",
|
||||
"**/default.gbui/**/*",
|
||||
"**/line.gbui/**/*"
|
||||
],
|
||||
"reporter": [
|
||||
"html"
|
||||
],
|
||||
"all": true
|
||||
}
|
|
@ -5,4 +5,4 @@
|
|||
"arrowParens": "avoid",
|
||||
"semi": true,
|
||||
"singleQuote": true
|
||||
}
|
||||
}
|
|
@ -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}};
|
||||
}
|
34
.travis.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
language: node_js
|
||||
|
||||
node_js:
|
||||
- lts/*
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
before_script:
|
||||
- npm run build
|
||||
|
||||
script:
|
||||
- npm run coveralls
|
||||
|
||||
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
|
22
.vscode/launch.json
vendored
|
@ -4,27 +4,17 @@
|
|||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"sourceMaps": true,
|
||||
"name": "Debug Program",
|
||||
"runtimeExecutable": "node",
|
||||
"program": "${workspaceRoot}/boot.mjs",
|
||||
"program": "${workspaceRoot}/dist/src/app.js",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {
|
||||
"NODE_ENV": "development",
|
||||
"NODE_NO_WARNINGS": "1"
|
||||
"NODE_ENV": "development"
|
||||
},
|
||||
"args": [
|
||||
"--require", "${workspaceRoot}/suppress-node-warnings.cjs"
|
||||
],
|
||||
"skipFiles": [
|
||||
"node_modules/**/*.js",
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"outFiles": [
|
||||
"${workspaceRoot}/dist/**/*.js"
|
||||
],
|
||||
"args":["--no-deprecation"],
|
||||
"skipFiles": ["node_modules/**/*.js"],
|
||||
"outFiles": ["${workspaceRoot}/dist/*.js"],
|
||||
"stopOnEntry": false,
|
||||
"console": "integratedTerminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
4
.vscode/settings.json
vendored
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"git.ignoreLimitWarning": true,
|
||||
"cmake.ignoreCMakeListsMissing": true
|
||||
}
|
30
.vscode/tasks.json
vendored
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
// 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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
2308
CHANGELOG.md
|
@ -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/
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
## 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 person’s 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
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using standard(no idiomatic expressions), welcoming and inclusive language
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
|
@ -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/
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -52,33 +52,6 @@ Your pull request should:
|
|||
* Have clear commit messages
|
||||
* e.g. "Refactor feature", "Fix issue", "Add tests for issue"
|
||||
|
||||
## You need to be able to run your system
|
||||
|
||||
from: http://catern.com/run.html
|
||||
|
||||
When developing a system, it is important to be able to run the system in its entirety.
|
||||
"Run the unit tests" doesn't count. The complexity of your system is in the interactions between the units.
|
||||
|
||||
"Run an individual service against mocks" doesn't count. A mock will rarely behave identically to the real dependency, and the behavior of the individual service will be unrealistic. You need to run the actual system.
|
||||
|
||||
"Run an individual service in a shared stateful development environment running all the other services" doesn't count. A shared development environment will be unreliable as it diverges more and more from the real system.
|
||||
|
||||
"Run most services in a mostly-isolated development environment, calling out to a few hard-to-run external services" doesn't count. Those few external services on the edge of the mostly-isolated development environment are often the most crucial ones; without the ability to run modified versions of them, your development process is crippled. Furthermore, being dependent on external services greatly complicates where and how you can run the system; it's much harder to, for example, run tests with the system on every commit if that will access external services.
|
||||
|
||||
"Run all the services that make up the system in an isolated development environment" counts; it's the bare minimum requirement. Bonus points if this can be done completely on localhost, without using an off-host cluster deployment system.
|
||||
|
||||
Without the ability to actually run the entire system in this way while developing, many evil practices will tend to become common.
|
||||
|
||||
Testing is harder and far less representative, and therefore many issues can only be found when changes are deployed to production.
|
||||
In turn, production deployment will cause issues more often, and so deployment will be more slow and less frequent.
|
||||
Deploying the system to new environments is more difficult, since the developers aren't able to actually run the system. Existing practices in production will be cargo-culted and copied around indefinitely, even when they are unnecessary or actively harmful.
|
||||
Exploratory usage of the system is very difficult, so it will be harder to consider using the system for purposes outside what it was originally developed for, and new use cases will become rare.
|
||||
Downstream clients who depend on the system will also suffer all these issues, since without the ability to run the upstream system in development, they can't run their own entire system, which is a superset of the upstream system.
|
||||
Running the entire system during development is the first step to preventing these issues. Further steps include writing automated tests for the system (which can be run repeatedly during development), and using, as much as possible, the same code to run the system in development and in production.
|
||||
Developers of large or legacy systems that cannot already be run in their entirety during development often believe that it is impractical to run the entire system during development. They'll talk about the many dependencies of their system, how it requires careful configuration of a large number of hosts, or how it's too complex to get reliable behavior.
|
||||
|
||||
In my experience, they're always wrong. These systems can be run locally during development with a relatively small investment of effort. Typically, these systems are just ultimately not as complicated as people think they are; once the system's dependencies are actually known and understood rather than being cargo-culted or assumed, running the system, and all its dependencies, is straightforward.
|
||||
|
||||
Being able to run your entire system during development is just about the most basic requirement for a software project. It's not, on its own, sufficient for your development practices to be high quality; but if you can't do this, then you're not even in the running.
|
||||
|
||||
## Running (and adding) the Tests
|
||||
|
||||
*Coming soon*
|
||||
|
|
|
@ -1,148 +0,0 @@
|
|||
|
||||
|
||||
# 2.0.0
|
||||
|
||||
``` SQL
|
||||
|
||||
ALTER TABLE dbo.GuaribasUser ADD
|
||||
agentSystemId nvarchar(16) NULL,
|
||||
agentMode nvarchar(16) NULL,
|
||||
agentContacted datetime NULL
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[GuaribasUser] DROP COLUMN [phone]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[GuaribasUser] DROP COLUMN [internalAddress]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[GuaribasUser] DROP COLUMN [currentBotId]
|
||||
GO
|
||||
|
||||
|
||||
|
||||
ALTER TABLE [dbo].[GuaribasInstance] DROP COLUMN [authenticatorClientId]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[GuaribasInstance] DROP COLUMN [authenticatorClientSecret]
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.GuaribasUser ADD
|
||||
locale nvarchar(5) NULL
|
||||
GO
|
||||
|
||||
|
||||
ALTER TABLE dbo.GuaribasInstance ADD
|
||||
translatorKey nvarchar(64) NULL
|
||||
translatorEndpoint nvarchar(64) NULL
|
||||
GO
|
||||
|
||||
|
||||
ALTER TABLE dbo.GuaribasInstance ADD
|
||||
activationCode nvarchar(16) NULL
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.GuaribasInstance ADD
|
||||
params nvarchar(4000) NULL
|
||||
GO
|
||||
|
||||
ALTER TABLE dbo.GuaribasInstance ADD
|
||||
state nvarchar(16) NULL
|
||||
GO
|
||||
UPDATE dbo.GuaribasInstance SET state= 'active'
|
||||
|
||||
# 2.0.3
|
||||
|
||||
``` SQL
|
||||
|
||||
ALTER TABLE dbo.GuaribasPackage ADD
|
||||
params custom(512) NULL
|
||||
GO
|
||||
|
||||
```
|
||||
|
||||
|
||||
# 2.0.56
|
||||
|
||||
ALTER TABLE dbo.GuaribasUser ADD
|
||||
hearOnDialog nvarchar(64) NULL
|
||||
GO
|
||||
|
||||
|
||||
ALTER TABLE dbo.GuaribasConversation ADD
|
||||
instanceId int,
|
||||
feedback nvarchar(512) NULL
|
||||
GO
|
||||
|
||||
|
||||
ALTER TABLE [dbo].[GuaribasInstance] DROP COLUMN [translatorendpoint]
|
||||
GO
|
||||
ALTER TABLE dbo.GuaribasInstance ADD
|
||||
translatorEndpoint nvarchar(128) NULL
|
||||
GO
|
||||
|
||||
|
||||
# 2.0.108
|
||||
|
||||
ALTER TABLE [dbo].[GuaribasInstance] DROP COLUMN [agentSystemId]
|
||||
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
|
2
LICENSE
|
@ -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
|
@ -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.
|
||||
|
341
README.md
|
@ -1,39 +1,73 @@
|
|||
### 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 |
|
||||
|------------------------------|----------------------------------------------------------------------------------------------------|
|
||||
| Community | [](https://stackoverflow.com/questions/tagged/generalbots) [](https://gitter.im/GeneralBots) [](https://badges.frapsoft.com) [](http://makeapullrequest.com) [](https://github.com/pragmatismo-io/BotServer/blob/master/LICENSE.txt)|
|
||||
| Management | [](https://gitHub.com/pragmatismo-io/BotServer/graphs/commit-activity) [](https://waffle.io/pragmatismo-io/BotServer) |
|
||||
| Security | [](https://snyk.io/test/github/pragmatismo-io/BotServer) |
|
||||
| Building & Quality | [](https://travis-ci.com/pragmatismo-io/BotServer) [](https://coveralls.io/github/pragmatismo-io/BotServer) [](https://github.com/prettier/prettier) |
|
||||
| Packaging | [](https://badge.fury.io) [](https://david-dm.org) [](https://greenkeeper.io/) [](http://commitizen.github.io/cz-cli/) |
|
||||
| Releases | [](https://www.npmjs.com/package/botserver/) [](https://www.npmjs.com/package/botlib/) [](https://github.com/semantic-release/semantic-release)|
|
||||
| Community | [](https://stackoverflow.com/questions/tagged/generalbots) [](https://badges.frapsoft.com) [](http://makeapullrequest.com) [](https://github.com/GeneralBots/BotServer/blob/master/LICENSE.txt)|
|
||||
| Management | [](https://gitHub.com/GeneralBots/BotServer/graphs/commit-activity) |
|
||||
| Security | [](https://snyk.io/test/github/GeneralBots/BotServer) |
|
||||
| Building & Quality | [](https://coveralls.io/github/GeneralBots/BotServer) [](https://github.com/prettier/prettier) |
|
||||
| Packaging | [](https://badge.fury.io) [](http://commitizen.github.io/cz-cli/) |
|
||||
| Samples | [BASIC](https://github.com/GeneralBots/BotServer/tree/master/packages/default.gbdialog) or [](https://github.com/GeneralBots/AzureADPasswordReset.gbapp)
|
||||
| [Docker Image](https://github.com/lpicanco/docker-botserver)  <br/> *Provided by [@lpicanco](https://github.com/lpicanco/docker-botserver)* |
|
||||
| [Docker Image](https://github.com/lpicanco/docker-botserver) |      <br/> *Provided by [@lpicanco](https://github.com/lpicanco/docker-botserver)* |
|
||||
|
||||
# General Bots
|
||||
#### Watch a video about easeness authoring of bot packages, development environment and self-deployment
|
||||
|
||||
)
|
||||
* Now with General Bots you can press F5 on Visual Studio to get a bot factory on your environment* published on November 10th, 2018.
|
||||
|
||||
[](https://www.youtube.com/watch?v=AfKTwljoMOs)
|
||||
|
||||
|
||||
Welcome to General Bot Community Edition
|
||||
----------------------------------------
|
||||
|
||||

|
||||
|
||||
General Bot is a 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.
|
||||
|
||||
|
||||
## Sample Package #1: [default.gbdialog (VBA)](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbdialog)
|
||||
|
||||
|
||||
* See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC * published on December 3rd, 2018.
|
||||
|
||||
[](https://www.youtube.com/watch?v=yX1sF9n9628)
|
||||
|
||||
|
||||
## Sample Package #2: [AzureADPasswordReset.gbapp (TypeScript)](https://github.com/pragmatismo-io/AzureADPasswordReset.gbapp)
|
||||
|
||||
|
||||
Custom dialogs for reseting user password in Azure Active Directory, Office 365, Dynamics 365 or any app published through Azure AD. See also [IntranetBotQuickStart.gbai](https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai) and related MSDN article **[Applied AI – Using a Bot for Password Reset](https://blogs.msdn.microsoft.com/buckwoody/2018/09/25/applied-ai-using-a-bot-for-password-reset)** by *Rodrigo Souza*.
|
||||
|
||||
|
||||
### Bot Administrator - Setup Security
|
||||
|
||||
So the Bot provides an **admin** mode allowing the user having the Directory.AccessAsUser.All permission to be logged on Administrative interface to obtain and save its token into the database.
|
||||
|
||||

|
||||
|
||||
### Bot User - Reset Password
|
||||
|
||||
|
||||
With the access token stored in the database, any user can access anonymously the
|
||||
bot and through a combination of e-mail and mobile received code, the user will be able to reset her or his password.
|
||||
|
||||
#### Reset password via Web
|
||||
|
||||
Any user can use a web address to talk to a reset password bot. Just provide credentials that are confronted with Microsoft Graph to ensure security.
|
||||
|
||||

|
||||
|
||||
general-bots-reset-ad-password.gif
|
||||
|
||||
#### Reset password via Skype
|
||||
|
||||
This is the case when user does not have the password to login on Skype for Business or Teams, and they need to reset their password, so the right tool is Skype.
|
||||
|
||||

|
||||
|
||||
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.
|
||||
|
||||
## What is a Bot Server?
|
||||
|
||||

|
||||
|
||||
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
|
||||
|
@ -43,132 +77,210 @@ no code. The Bot Server also provides a framework to develop bot packages in a m
|
|||
advanced fashion writing custom code in editors like Visual Studio Code, Atom or Brackets.
|
||||
|
||||
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.
|
||||
favorite tools like Excel (or any text editor) or Photoshop (or any image
|
||||
editor).
|
||||
|
||||
## Getting Started
|
||||
Package Quick Reference
|
||||
------------
|
||||
|Whatsapp|Web|Core|KB|
|
||||
|----|-----|----|----|
|
||||
|[whatsapp.gblib](https://github.com/pragmatismo-io/BotServer/tree/master/packages/whatsapp.gblib)|[default.gbui](https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbui)|[core.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/core.gbapp)|[kb.gbapp](https://github.com/pragmatismo-io/BotServer/tree/master/packages/kb.gbapp)|
|
||||
|
||||
### Prerequisites
|
||||
### The bot development stack
|
||||
|
||||
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).
|
||||
### The Bot Factory
|
||||
|
||||
### Quick Start Guide
|
||||

|
||||
|
||||
Follow these steps to get your General Bots server up and running:
|
||||
GeneralBots aims to delivery bots in azure in a very easy and fast fashion. Use Office tools like Word or Excel to edit your Bot - using code (JavaScript or TypeScript) just to empower custom requirements.
|
||||
|
||||
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.
|
||||
#### Use Excel for (Hierarchical) Knowledge Base Editing
|
||||
|
||||
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
|
||||
#### Use Visual Studio for a complete .gbai package building system
|
||||
|
||||
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.
|
||||
How To
|
||||
------
|
||||
|
||||
## Development Workflow
|
||||
### Run the server locally
|
||||
|
||||
### 1. Project Structure
|
||||
1. Install [Node.js](https://www.npmjs.com/get-npm) the current generation General Bot code execution platform;
|
||||
2. Open a **Terminal** on Linux and Mac or a **Command Prompt** window on Windows;
|
||||
3. Type `npm install -g botserver` and press *ENTER*;
|
||||
4. Type `gbot` to run the server core.
|
||||
|
||||
The General Bots server follows a modular architecture designed for flexibility and scalability. Here's an overview of the main directories:
|
||||
Notes:
|
||||
|
||||
```
|
||||
BotServer/
|
||||
├── packages/
|
||||
│ ├── core.gbapp/ # Core bot functionality
|
||||
│ ├── kb.gbapp/ # Knowledge base packages
|
||||
├── src / # Main entry point
|
||||
└── package.json # Project configuration
|
||||
```
|
||||
* [*nodejs.install* Chocolatey Package](https://chocolatey.org/packages/nodejs.install) is also available.
|
||||
* The zip source code of General Bot is also available for [Download](https://codeload.github.com/pragmatismo-io/BotServer/zip/master);
|
||||
|
||||
This structure allows for easy navigation and management of different aspects of your bot project.
|
||||
### Configure the server to deploy specific directory
|
||||
|
||||
### 2. Creating Custom Packages
|
||||
1. Create/Edit the .env file and add the ADDITIONAL_DEPLOY_PATH key pointing to the .gbai local parent folder of .gbapp, .gbot, .gbtheme, .gbkb package directories.
|
||||
2. Specify STORAGE_SYNC to TRUE so database sync is run when the server is run.
|
||||
3. In case of Microsoft SQL Server add the following keys: STORAGE_SERVER, STORAGE_NAME, STORAGE_USERNAME, STORAGE_PASSWORD, STORAGE_DIALECT to `mssql`.
|
||||
|
||||
One of the strengths of General Bots is its extensibility. You can create custom packages to enhance your bot's capabilities:
|
||||
Note:
|
||||
|
||||
- **.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.
|
||||
* You can specify several bots separated by semicolon, the BotServer will serve all of them at once.
|
||||
|
||||
Each package type has its own structure and purpose, which we'll explore in depth in their respective chapters.
|
||||
## Setup development environment (Windows)
|
||||
|
||||
## Samples
|
||||
1. [Optional] Install [Chocolatey](https://chocolatey.org/install), a Windows Package Manager;
|
||||
2. Install [git](`https://git-scm.com/`), a Software Configuration Management (SCM).;
|
||||
3. Install [Node.js](npmjs.com/get-npm), a [Runtime system](https://en.wikipedia.org/wiki/Runtime_system).
|
||||
(https://www.npmjs.com/get-npm) (suggested: LTS 8.x.x);
|
||||
4. Install [Visual Studio Code](https://chocolatey.org/packages/nodejs.install), Brackets or Atom as an editor of your choice;
|
||||
5. [Fork](https://en.wikipedia.org/wiki/Fork_(software_development)) by visiting https://github.com/pragmatismo-io/BotServer/fork
|
||||
6. Clone the just forked repository by running `git clone <your-forked-repository-url>/BotServer.git` ;
|
||||
7. Run `npm install -g typescript`;
|
||||
8. Run `npm install` on Command Prompt or PowerShell on the General Bot source-code folder;
|
||||
9. Enter './packages/default.gbui' folder;
|
||||
10. Run `npm install` folled by `npm run build` (To build default Bot UI);
|
||||
11. Enter the On the downloaded folder (../..);
|
||||
12. Compile the bot server by `tsc`.
|
||||
13. Run the bot server by `npm start`.
|
||||
|
||||
Several samples, including a Bot for AD Password Reset, are avaiable on the [repository list](https://github.com/GeneralBots).
|
||||
Note:
|
||||
|
||||
### Using complete General Bots Conversational Data Analytics
|
||||
* Whenever you are ready to turn your open-source bot ideas in form of .gbapp (source-code) and artifacts like .gbkb, .gbtheme, .gbot or the .gbai full package read [CONTRIBUTING.md](https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md) about performing Pull Requests (PR) and creating other public custom packages repositories of your own personal or organization General Bot Community Edition powered packages.
|
||||
|
||||

|
||||
### Running unit tests
|
||||
|
||||
```
|
||||
TALK "General Bots Labs presents FISCAL DATA SHOW BY BASIC"
|
||||
1. Enter the BotServer root folder.
|
||||
2. Run tests by `npm test`.
|
||||
|
||||
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)
|
||||
### Just copy the source code to your machine
|
||||
|
||||
TALK "Demonstration of Gift Contributions with AS IMAGE keyword"
|
||||
SET THEME dark
|
||||
png = data as IMAGE
|
||||
SEND FILE png
|
||||
1. [Download] the Zip file of (https://codeload.github.com/pragmatismo-io/BotServer/zip/master)
|
||||
|
||||
DELAY 5
|
||||
TALK " Demonstration of Gift Contributions CHART keyword"
|
||||
img = CHART "bar", data
|
||||
SEND FILE img
|
||||
```
|
||||
### Updating the Bot Knoledge Base (.gbkb folder)
|
||||
|
||||
## Guide
|
||||
The subjects.json file contains all information related to the subject tree and can be used to build the menu carrousel as well give a set of words to be used as subject catcher in the conversation. A hierarchy can be specified.
|
||||
|
||||
[Read the General Bots BotBook Guide](https://docs.pragmatismo.com.br)
|
||||
### Creating a new Theme folder (.gbtheme folder)
|
||||
|
||||
# Videos
|
||||
A theme is composed of some CSS files and images. That set of files can change
|
||||
everything in the General Bot UI. Use them extensively before going to change
|
||||
the UI application itself (HTML & JS).
|
||||
|
||||
7 AI General Bots LLM Templates for Goodness
|
||||
[https://www.youtube.com/watch?v=KJgvUPXi3Fw](https://www.youtube.com/watch?v=KJgvUPXi3Fw)
|
||||
|
||||
# Contributing
|
||||
Package Types
|
||||
-------------
|
||||
|
||||
### .gbai
|
||||
|
||||
Embraces all packages types (content, logic & conversation) into a pluggable bot
|
||||
directory. [A sample .gbai is available](https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai).
|
||||
|
||||
### .gbapp
|
||||
|
||||
The artificial intelligence extensions in form of pluggable apps. Dialogs,
|
||||
Services and all model related to data. A set of interactions, use cases,
|
||||
integrations in form of conversationals dialogs.
|
||||
The .gbapp adds the General Bot base library (botlib) for building Node.js TypeScript Apps packages.
|
||||
|
||||
|
||||
Four components builds up a General Bot App:
|
||||
|
||||
* dialogs
|
||||
* models
|
||||
* services
|
||||
* tests
|
||||
|
||||
#### Dialogs
|
||||
|
||||
All code contained in a dialog builds the flow to custom conversations in
|
||||
built-in and additional packages .
|
||||
|
||||
|
||||
#### Models
|
||||
|
||||
Models builds the foundation of data relationships in form of entities.
|
||||
|
||||
|
||||
#### Services
|
||||
|
||||
Services are a façade for bot back-end logic and other custom processing.
|
||||
|
||||
#### Tests
|
||||
|
||||
Tests try to automate code execution validation before crashing in production.
|
||||
|
||||
|
||||
### .gbot
|
||||
|
||||
An expression of an artificial inteligence entity. A .gbot file defines
|
||||
all bots dependencies related to services and other resources.
|
||||
|
||||
### .gbtheme
|
||||
|
||||
A theme of a bot at a given time. CSS files & images that can compose all UI
|
||||
presentation and using it a branding can be done. [A sample .gbtheme is available](https://github.com/pragmatismo-io/Office365.gbtheme)
|
||||
|
||||
### .gbkb
|
||||
|
||||
A set of subjects that bot knows in a form of hierarchical menu-based QnA. [A sample .gbkb is available](https://github.com/pragmatismo-io/ProjectOnline.gbkb).
|
||||
|
||||
### .gblib
|
||||
|
||||
Shared code that can be used across bot apps.
|
||||
|
||||
Reference
|
||||
---------
|
||||
|
||||
### GeneralBots admin commands
|
||||
|
||||
General Bot can be controlled by the same chat window people talk to, so
|
||||
here is a list of admin commands related to deploying .gb* files.
|
||||
|
||||
| Command | Description |
|
||||
|-----------------|-----------------------------------------------------------------------------------------------------------------|
|
||||
| deployPackage | Deploy a KB package. Usage **deployPackage** [package-name]. Then, you need to run rebuildIndex. |
|
||||
| undeployPackage | Undeploy a KB. Usage **undeployPackage** [package-name]. |
|
||||
| redeployPackage | Undeploy and then deploys the KB. Usage **redeployPackage** [package-name]. Then, you need to run rebuildIndex. |
|
||||
| setupSecurity | Setup connection to user directories. |
|
||||
|
||||
Discontinued commands:
|
||||
|
||||
| Command | Description |Reason |
|
||||
|-----------------| -----------------------------------------------------------------------------------------------------------------|------|
|
||||
| rebuildIndex | Rebuild Azure Search indexes, must be run after **deployPackage** or **redeployPackage**. | Now it is called automatically |
|
||||
|
||||
### Credits & Inspiration
|
||||
|
||||
* Rodrigo Rodriguez (me@rodrigorodriguez.com) - Coding, Docs & Architecture.
|
||||
* David Lerner (david.lerner@hotmail.com) - UI, UX & Theming.
|
||||
* Eduardo Romeiro (eromeirosp@outlook.com) - Content & UX.
|
||||
* Jorge Ramos (jramos@pobox.com) - Coding, Docs & Architecture.
|
||||
* PH Nascimento (ph.an@outlook.com) - Product Manager
|
||||
|
||||
Powered by Microsoft [BOT Framework](https://dev.botframework.com/) and [Azure](http://www.azure.com).
|
||||
|
||||
General Bot Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brasil, 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".
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions and suggestions.
|
||||
See our [Contribution Guidelines](https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md) for more details.
|
||||
|
||||
# Reporting Security Issues
|
||||
## 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
|
||||
## 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 +296,11 @@ 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> <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".
|
||||
|
||||
<a href="https://stackoverflow.com/questions/ask?tags=generalbots">:speech_balloon: Ask a question</a> <a href="/docs">:book: Read the Docs</a>
|
||||
</h2>
|
||||
|
|
7
SAMPLES.md
Normal 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. |
|
61
SECURITY.md
|
@ -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
|
79
WARNINGS.md
|
@ -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
|
||||
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
BIN
blank.docx
BIN
blank.xlsx
57
boot.mjs
|
@ -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);
|
||||
}
|
16
deploy.cmd
|
@ -59,7 +59,7 @@ IF DEFINED KUDU_SELECT_NODE_VERSION_CMD (
|
|||
SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp"
|
||||
IF !ERRORLEVEL! NEQ 0 goto error
|
||||
)
|
||||
|
||||
|
||||
IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" (
|
||||
SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp"
|
||||
IF !ERRORLEVEL! NEQ 0 goto error
|
||||
|
@ -96,7 +96,7 @@ call :SelectNodeVersion
|
|||
:: 3. Install npm packages
|
||||
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
|
||||
pushd "%DEPLOYMENT_TARGET%"
|
||||
echo [General Bots Deployer] Installing packages for server...
|
||||
echo [GUARIBASDEPLOYER] Installing packages for server.
|
||||
call :ExecuteCmd !NPM_CMD! install --production
|
||||
IF !ERRORLEVEL! NEQ 0 goto error
|
||||
popd
|
||||
|
@ -106,21 +106,19 @@ IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
|
|||
IF EXIST "%DEPLOYMENT_TARGET%\deploy\default.gbui\package.json" (
|
||||
call :ExecuteCmd !NPM_CMD! config set scripts-prepend-node-path true
|
||||
pushd "%DEPLOYMENT_TARGET%\deploy\default.gbui"
|
||||
echo [General Bots Deployer] Installing packages for default.gbui...
|
||||
echo [GUARIBASDEPLOYER] Installing packages for default.gbui.
|
||||
call :ExecuteCmd !NPM_CMD! install
|
||||
echo [General Bots Deployer] Building default.gbui...
|
||||
echo [GUARIBASDEPLOYER] Building default.gbui.
|
||||
call :ExecuteCmd !NPM_CMD! run build
|
||||
IF !ERRORLEVEL! NEQ 0 goto error
|
||||
RMDIR /s /q "%DEPLOYMENT_TARGET%\deploy\default.gbui\node_modules"
|
||||
popd
|
||||
)
|
||||
)
|
||||
|
||||
:: 4. Install TypeScript
|
||||
echo [General Bots Deployer] Transpiling...
|
||||
:: 4. Install typescript
|
||||
echo [GUARIBASDEPLOYER] 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%"
|
||||
|
||||
echo [General Bots Deployer] Deployment Finished.
|
||||
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
goto end
|
||||
|
|
96
deploy.sh
|
@ -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."
|
1263
directline-v2.json
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 280 KiB |
7
docs/reference/assets/css/main.css.map
Normal file
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
234
docs/reference/classes/_src_app_.gbserver.html
Normal file
|
@ -0,0 +1,234 @@
|
|||
<!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">"src/app"</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>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>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/rodrigorodriguez/BotServer/blob/8490f5e/src/app.ts#L65">src/app.ts:65</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">"src/app"</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-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-variable tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a href="../modules/_src_app_.html#apppackages" class="tsd-kind-icon">app<wbr>Packages</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#logger" class="tsd-kind-icon">logger</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>
|
||||
</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="http://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>
|
334
docs/reference/globals.html
Normal file
|
@ -0,0 +1,334 @@
|
|||
<!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">"packages/admin.gbapp/dialogs/<wbr>Admin<wbr>Dialog"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_index_.html" class="tsd-kind-icon">"packages/admin.gbapp/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_models_adminmodel_.html" class="tsd-kind-icon">"packages/admin.gbapp/models/<wbr>Admin<wbr>Model"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_services_gbadminservice_.html" class="tsd-kind-icon">"packages/admin.gbapp/services/GBAdmin<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_admin_gbapp_strings_.html" class="tsd-kind-icon">"packages/admin.gbapp/strings"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_analytics_gblib_index_.html" class="tsd-kind-icon">"packages/analytics.gblib/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_analytics_gblib_models_index_.html" class="tsd-kind-icon">"packages/analytics.gblib/models/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_azuredeployer_gbapp_services_azuredeployerservice_.html" class="tsd-kind-icon">"packages/azuredeployer.gbapp/services/<wbr>Azure<wbr>Deployer<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_dialogs_welcomedialog_.html" class="tsd-kind-icon">"packages/core.gbapp/dialogs/<wbr>Welcome<wbr>Dialog"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_dialogs_whoamidialog_.html" class="tsd-kind-icon">"packages/core.gbapp/dialogs/<wbr>Who<wbr>AmIDialog"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_index_.html" class="tsd-kind-icon">"packages/core.gbapp/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_models_gbmodel_.html" class="tsd-kind-icon">"packages/core.gbapp/models/GBModel"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbapiservice_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBAPIService"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbconfigservice_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBConfig<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbconversationalservice_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBConversational<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbcoreservice_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBCore<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbdeployer_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBDeployer"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbimporterservice_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBImporter<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbminservice_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBMin<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_gbvmservice_.html" class="tsd-kind-icon">"packages/core.gbapp/services/GBVMService"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_services_tscompiler_.html" class="tsd-kind-icon">"packages/core.gbapp/services/TSCompiler"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_core_gbapp_strings_.html" class="tsd-kind-icon">"packages/core.gbapp/strings"</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">"packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Feedback<wbr>Dialog"</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">"packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Quality<wbr>Dialog"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_index_.html" class="tsd-kind-icon">"packages/customer-<wbr>satisfaction.gbapp/index"</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">"packages/customer-<wbr>satisfaction.gbapp/models/index"</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">"packages/customer-<wbr>satisfaction.gbapp/services/CSService"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_customer_satisfaction_gbapp_strings_.html" class="tsd-kind-icon">"packages/customer-<wbr>satisfaction.gbapp/strings"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_dialogs_askdialog_.html" class="tsd-kind-icon">"packages/kb.gbapp/dialogs/<wbr>Ask<wbr>Dialog"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_dialogs_faqdialog_.html" class="tsd-kind-icon">"packages/kb.gbapp/dialogs/<wbr>Faq<wbr>Dialog"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_dialogs_menudialog_.html" class="tsd-kind-icon">"packages/kb.gbapp/dialogs/<wbr>Menu<wbr>Dialog"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_index_.html" class="tsd-kind-icon">"packages/kb.gbapp/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_models_index_.html" class="tsd-kind-icon">"packages/kb.gbapp/models/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_services_kbservice_.html" class="tsd-kind-icon">"packages/kb.gbapp/services/KBService"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_kb_gbapp_strings_.html" class="tsd-kind-icon">"packages/kb.gbapp/strings"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_security_gblib_index_.html" class="tsd-kind-icon">"packages/security.gblib/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_security_gblib_models_index_.html" class="tsd-kind-icon">"packages/security.gblib/models/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_security_gblib_services_secservice_.html" class="tsd-kind-icon">"packages/security.gblib/services/<wbr>Sec<wbr>Service"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_whatsapp_gblib_index_.html" class="tsd-kind-icon">"packages/whatsapp.gblib/index"</a></li>
|
||||
<li class="tsd-kind-external-module tsd-is-external"><a href="modules/_packages_whatsapp_gblib_services_whatsappdirectline_.html" class="tsd-kind-icon">"packages/whatsapp.gblib/services/<wbr>Whatsapp<wbr>Direct<wbr>Line"</a></li>
|
||||
<li class="tsd-kind-external-module"><a href="modules/_src_app_.html" class="tsd-kind-icon">"src/app"</a></li>
|
||||
<li class="tsd-kind-external-module"><a href="modules/_src_logger_.html" class="tsd-kind-icon">"src/logger"</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">"src/app"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module">
|
||||
<a href="modules/_src_logger_.html">"src/logger"</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">"packages/admin.gbapp/dialogs/<wbr>Admin<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_index_.html">"packages/admin.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_models_adminmodel_.html">"packages/admin.gbapp/models/<wbr>Admin<wbr>Model"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_services_gbadminservice_.html">"packages/admin.gbapp/services/GBAdmin<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_strings_.html">"packages/admin.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_analytics_gblib_index_.html">"packages/analytics.gblib/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_analytics_gblib_models_index_.html">"packages/analytics.gblib/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_azuredeployer_gbapp_services_azuredeployerservice_.html">"packages/azuredeployer.gbapp/services/<wbr>Azure<wbr>Deployer<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_dialogs_welcomedialog_.html">"packages/core.gbapp/dialogs/<wbr>Welcome<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_dialogs_whoamidialog_.html">"packages/core.gbapp/dialogs/<wbr>Who<wbr>AmIDialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_index_.html">"packages/core.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_models_gbmodel_.html">"packages/core.gbapp/models/GBModel"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbapiservice_.html">"packages/core.gbapp/services/GBAPIService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbconfigservice_.html">"packages/core.gbapp/services/GBConfig<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbconversationalservice_.html">"packages/core.gbapp/services/GBConversational<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbcoreservice_.html">"packages/core.gbapp/services/GBCore<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbdeployer_.html">"packages/core.gbapp/services/GBDeployer"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbimporterservice_.html">"packages/core.gbapp/services/GBImporter<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbminservice_.html">"packages/core.gbapp/services/GBMin<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbvmservice_.html">"packages/core.gbapp/services/GBVMService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_tscompiler_.html">"packages/core.gbapp/services/TSCompiler"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_strings_.html">"packages/core.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_feedbackdialog_.html">"packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Feedback<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_qualitydialog_.html">"packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Quality<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_index_.html">"packages/customer-<wbr>satisfaction.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_models_index_.html">"packages/customer-<wbr>satisfaction.gbapp/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_services_csservice_.html">"packages/customer-<wbr>satisfaction.gbapp/services/CSService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_strings_.html">"packages/customer-<wbr>satisfaction.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_dialogs_askdialog_.html">"packages/kb.gbapp/dialogs/<wbr>Ask<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_dialogs_faqdialog_.html">"packages/kb.gbapp/dialogs/<wbr>Faq<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_dialogs_menudialog_.html">"packages/kb.gbapp/dialogs/<wbr>Menu<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_index_.html">"packages/kb.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_models_index_.html">"packages/kb.gbapp/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_services_kbservice_.html">"packages/kb.gbapp/services/KBService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_strings_.html">"packages/kb.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_security_gblib_index_.html">"packages/security.gblib/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_security_gblib_models_index_.html">"packages/security.gblib/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_security_gblib_services_secservice_.html">"packages/security.gblib/services/<wbr>Sec<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_whatsapp_gblib_index_.html">"packages/whatsapp.gblib/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_whatsapp_gblib_services_whatsappdirectline_.html">"packages/whatsapp.gblib/services/<wbr>Whatsapp<wbr>Direct<wbr>Line"</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>
|
||||
</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="http://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>
|
|
@ -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>
|
||||
|
@ -66,46 +72,64 @@
|
|||
</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>
|
||||
<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://gitter.im/GeneralBots"><img src="https://img.shields.io/gitter/room/pragmatismo-io/GeneralBots.svg" alt="Gitter"></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/pragmatismo-io/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>
|
||||
<td><a href="https://gitHub.com/pragmatismo-io/BotServer/graphs/commit-activity"><img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" alt="Maintenance"></a> <a href="https://waffle.io/pragmatismo-io/BotServer"><img src="https://badge.waffle.io/pragmatismo-io/BotServer.svg?columns=all" alt="Waffle.io - Columns and their card count"></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>
|
||||
<td><a href="https://snyk.io/test/github/pragmatismo-io/BotServer"><img src="https://snyk.io/test/github/pragmatismo-io/BotServer/badge.svg" alt="Known Vulnerabilities"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Building & 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>
|
||||
<td><a href="https://travis-ci.com/pragmatismo-io/BotServer"><img src="https://travis-ci.com/pragmatismo-io/BotServer.svg?branch=master" alt="Build Status"></a> <a href="https://coveralls.io/github/pragmatismo-io/BotServer"><img src="https://coveralls.io/repos/github/pragmatismo-io/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>
|
||||
<td><a href="https://badge.fury.io"><img src="https://badge.fury.io/js/botserver.svg" alt="forthebadge"></a> <a href="https://david-dm.org"><img src="https://david-dm.org/pragmatismo-io/botserver.svg" alt="Dependencies"></a> <a href="https://greenkeeper.io/"><img src="https://badges.greenkeeper.io/pragmatismo-io/BotServer.svg" alt="Greenkeeper badge"></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>
|
||||
<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><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>
|
||||
<h4 id="watch-a-video-about-easeness-authoring-of-bot-packages-development-environment-and-self-deployment">Watch a video about easeness authoring of bot packages, development environment and self-deployment</h4>
|
||||
<ul>
|
||||
<li>Now with General Bots you can press F5 on Visual Studio to get a bot factory on your environment* published on November 10th, 2018.</li>
|
||||
</ul>
|
||||
<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>
|
||||
<h2 id="welcome-to-general-bot-community-edition">Welcome to General Bot Community Edition</h2>
|
||||
<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>General Bot is a 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>
|
||||
<h2 id="sample-package-1-default-gbdialog-vba-">Sample Package #1: <a href="https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbdialog">default.gbdialog (VBA)</a></h2>
|
||||
<ul>
|
||||
<li>See how easy is to use 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC * published on December 3rd, 2018.</li>
|
||||
</ul>
|
||||
<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 'hear' and 'talk' to build Microsoft BOT Framework v4 logic with plain BASIC"></a></p>
|
||||
<h2 id="sample-package-2-azureadpasswordreset-gbapp-typescript-">Sample Package #2: <a href="https://github.com/pragmatismo-io/AzureADPasswordReset.gbapp">AzureADPasswordReset.gbapp (TypeScript)</a></h2>
|
||||
<p>Custom dialogs for reseting user password in Azure Active Directory, Office 365, Dynamics 365 or any app published through Azure AD. See also <a href="https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai">IntranetBotQuickStart.gbai</a> and related MSDN article <strong><a href="https://blogs.msdn.microsoft.com/buckwoody/2018/09/25/applied-ai-using-a-bot-for-password-reset">Applied AI – Using a Bot for Password Reset</a></strong> by <em>Rodrigo Souza</em>.</p>
|
||||
<h3 id="bot-administrator-setup-security">Bot Administrator - Setup Security</h3>
|
||||
<p>So the Bot provides an <strong>admin</strong> mode allowing the user having the Directory.AccessAsUser.All permission to be logged on Administrative interface to obtain and save its token into the database.</p>
|
||||
<p><img src="https://raw.githubusercontent.com/pragmatismo-io/AzureADPasswordReset.gbapp/master/docs/general-bots-reset-ad-password-admin.gif" alt="General Bot Logo"></p>
|
||||
<h3 id="bot-user-reset-password">Bot User - Reset Password</h3>
|
||||
<p>With the access token stored in the database, any user can access anonymously the
|
||||
bot and through a combination of e-mail and mobile received code, the user will be able to reset her or his password.</p>
|
||||
<h4 id="reset-password-via-web">Reset password via Web</h4>
|
||||
<p>Any user can use a web address to talk to a reset password bot. Just provide credentials that are confronted with Microsoft Graph to ensure security.</p>
|
||||
<p><img src="https://raw.githubusercontent.com/pragmatismo-io/AzureADPasswordReset.gbapp/master/docs/password.gif" alt="General Bot Logo"></p>
|
||||
<p>general-bots-reset-ad-password.gif </p>
|
||||
<h4 id="reset-password-via-skype">Reset password via Skype</h4>
|
||||
<p>This is the case when user does not have the password to login on Skype for Business or Teams, and they need to reset their password, so the right tool is Skype.</p>
|
||||
<p><img src="https://raw.githubusercontent.com/pragmatismo-io/AzureADPasswordReset.gbapp/master/docs/general-bots-reset-ad-password.gif" alt="General Bot Logo"></p>
|
||||
<h2 id="what-is-a-bot-server-">What is a Bot Server?</h2>
|
||||
<p><img src="https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/generalbots-open-core-starting-from-scratch.gif" alt="General Bots Starting From Scrach"></p>
|
||||
<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
|
||||
|
@ -114,39 +138,191 @@
|
|||
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 'hear' and 'talk' 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 'hear' and 'talk' 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>
|
||||
favorite tools like Excel (or any text editor) or Photoshop (or any image
|
||||
editor).</p>
|
||||
<h2 id="package-quick-reference">Package Quick Reference</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Whatsapp</th>
|
||||
<th>Web</th>
|
||||
<th>Core</th>
|
||||
<th>KB</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td><a href="https://github.com/pragmatismo-io/BotServer/tree/master/packages/whatsapp.gblib">whatsapp.gblib</a></td>
|
||||
<td><a href="https://github.com/pragmatismo-io/BotServer/tree/master/packages/default.gbui">default.gbui</a></td>
|
||||
<td><a href="https://github.com/pragmatismo-io/BotServer/tree/master/packages/core.gbapp">core.gbapp</a></td>
|
||||
<td><a href="https://github.com/pragmatismo-io/BotServer/tree/master/packages/kb.gbapp">kb.gbapp</a></td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h3 id="the-bot-development-stack">The bot development stack</h3>
|
||||
<p><img src="https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-stack.png" alt="General Bot Logo"></p>
|
||||
<h3 id="the-bot-factory">The Bot Factory</h3>
|
||||
<p><img src="https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-block-architecture.png" alt="General Bots Block Architecture"></p>
|
||||
<p>GeneralBots aims to delivery bots in azure in a very easy and fast fashion. Use Office tools like Word or Excel to edit your Bot - using code (JavaScript or TypeScript) just to empower custom requirements.</p>
|
||||
<h4 id="use-excel-for-hierarchical-knowledge-base-editing">Use Excel for (Hierarchical) Knowledge Base Editing</h4>
|
||||
<p><img src="https://github.com/pragmatismo-io/BotServer/blob/master/docs/images/general-bots-composing-subjects-json-and-excel.gif" alt="General Bots Inside Excel can enable bot production the masses"></p>
|
||||
<h4 id="use-visual-studio-for-a-complete-gbai-package-building-system">Use Visual Studio for a complete .gbai package building system</h4>
|
||||
<p><img src="https://raw.githubusercontent.com/pragmatismo-io/BotServer/master/docs/images/general-bots-inside-visual-studio-code-provides-a-complete-artificial-intelligence-based-conversational-platform.png" alt="General Bots Inside Visual Studio Code provides a complete artificial intelligence based conversational platform"></p>
|
||||
<h2 id="how-to">How To</h2>
|
||||
<h3 id="run-the-server-locally">Run the server locally</h3>
|
||||
<ol>
|
||||
<li>Install <a href="https://www.npmjs.com/get-npm">Node.js</a> the current generation General Bot code execution platform;</li>
|
||||
<li>Open a <strong>Terminal</strong> on Linux and Mac or a <strong>Command Prompt</strong> window on Windows;</li>
|
||||
<li>Type <code>npm install -g botserver</code> and press <em>ENTER</em>;</li>
|
||||
<li>Type <code>gbot</code> to run the server core.</li>
|
||||
</ol>
|
||||
<p>Notes:</p>
|
||||
<ul>
|
||||
<li><a href="https://chocolatey.org/packages/nodejs.install"><em>nodejs.install</em> Chocolatey Package</a> is also available.</li>
|
||||
<li>The zip source code of General Bot is also available for <a href="https://codeload.github.com/pragmatismo-io/BotServer/zip/master">Download</a>;</li>
|
||||
</ul>
|
||||
<h3 id="configure-the-server-to-deploy-specific-directory">Configure the server to deploy specific directory</h3>
|
||||
<ol>
|
||||
<li>Create/Edit the .env file and add the ADDITIONAL_DEPLOY_PATH key pointing to the .gbai local parent folder of .gbapp, .gbot, .gbtheme, .gbkb package directories.</li>
|
||||
<li>Specify STORAGE_SYNC to TRUE so database sync is run when the server is run.</li>
|
||||
<li>In case of Microsoft SQL Server add the following keys: STORAGE_SERVER, STORAGE_NAME, STORAGE_USERNAME, STORAGE_PASSWORD, STORAGE_DIALECT to <code>mssql</code>.</li>
|
||||
</ol>
|
||||
<p>Note:</p>
|
||||
<ul>
|
||||
<li>You can specify several bots separated by semicolon, the BotServer will serve all of them at once.</li>
|
||||
</ul>
|
||||
<h2 id="setup-development-environment-windows-">Setup development environment (Windows)</h2>
|
||||
<ol>
|
||||
<li>[Optional] Install <a href="https://chocolatey.org/install">Chocolatey</a>, a Windows Package Manager;</li>
|
||||
<li>Install <a href="%60https://git-scm.com/%60">git</a>, a Software Configuration Management (SCM).;</li>
|
||||
<li>Install <a href="npmjs.com/get-npm">Node.js</a>, a <a href="https://en.wikipedia.org/wiki/Runtime_system">Runtime system</a>.
|
||||
(<a href="https://www.npmjs.com/get-npm">https://www.npmjs.com/get-npm</a>) (suggested: LTS 8.x.x);</li>
|
||||
<li>Install <a href="https://chocolatey.org/packages/nodejs.install">Visual Studio Code</a>, Brackets or Atom as an editor of your choice;</li>
|
||||
<li><a href="https://en.wikipedia.org/wiki/Fork_(software_development)">Fork</a> by visiting <a href="https://github.com/pragmatismo-io/BotServer/fork">https://github.com/pragmatismo-io/BotServer/fork</a></li>
|
||||
<li>Clone the just forked repository by running <code>git clone <your-forked-repository-url>/BotServer.git</code> ;</li>
|
||||
<li>Run <code>npm install -g typescript</code>;</li>
|
||||
<li>Run <code>npm install</code> on Command Prompt or PowerShell on the General Bot source-code folder;</li>
|
||||
<li>Enter './packages/default.gbui' folder;</li>
|
||||
<li>Run <code>npm install</code> folled by <code>npm run build</code> (To build default Bot UI);</li>
|
||||
<li>Enter the On the downloaded folder (../..);</li>
|
||||
<li>Compile the bot server by <code>tsc</code>.</li>
|
||||
<li>Run the bot server by <code>npm start</code>.</li>
|
||||
</ol>
|
||||
<p>Note:</p>
|
||||
<ul>
|
||||
<li>Whenever you are ready to turn your open-source bot ideas in form of .gbapp (source-code) and artifacts like .gbkb, .gbtheme, .gbot or the .gbai full package read <a href="https://github.com/pragmatismo-io/BotServer/blob/master/CONTRIBUTING.md">CONTRIBUTING.md</a> about performing Pull Requests (PR) and creating other public custom packages repositories of your own personal or organization General Bot Community Edition powered packages.</li>
|
||||
</ul>
|
||||
<h3 id="running-unit-tests">Running unit tests</h3>
|
||||
<ol>
|
||||
<li>Enter the BotServer root folder.</li>
|
||||
<li>Run tests by <code>npm test</code>.</li>
|
||||
</ol>
|
||||
<h3 id="just-copy-the-source-code-to-your-machine">Just copy the source code to your machine</h3>
|
||||
<ol>
|
||||
<li>[Download] the Zip file of (<a href="https://codeload.github.com/pragmatismo-io/BotServer/zip/master">https://codeload.github.com/pragmatismo-io/BotServer/zip/master</a>)</li>
|
||||
</ol>
|
||||
<h3 id="updating-the-bot-knoledge-base-gbkb-folder-">Updating the Bot Knoledge Base (.gbkb folder)</h3>
|
||||
<p>The subjects.json file contains all information related to the subject tree and can be used to build the menu carrousel as well give a set of words to be used as subject catcher in the conversation. A hierarchy can be specified.</p>
|
||||
<h3 id="creating-a-new-theme-folder-gbtheme-folder-">Creating a new Theme folder (.gbtheme folder)</h3>
|
||||
<p>A theme is composed of some CSS files and images. That set of files can change
|
||||
everything in the General Bot UI. Use them extensively before going to change
|
||||
the UI application itself (HTML & JS).</p>
|
||||
<h2 id="package-types">Package Types</h2>
|
||||
<h3 id="-gbai">.gbai</h3>
|
||||
<p>Embraces all packages types (content, logic & conversation) into a pluggable bot
|
||||
directory. <a href="https://github.com/pragmatismo-io/IntranetBotQuickStart.gbai">A sample .gbai is available</a>.</p>
|
||||
<h3 id="-gbapp">.gbapp</h3>
|
||||
<p>The artificial intelligence extensions in form of pluggable apps. Dialogs,
|
||||
Services and all model related to data. A set of interactions, use cases,
|
||||
integrations in form of conversationals dialogs.
|
||||
The .gbapp adds the General Bot base library (botlib) for building Node.js TypeScript Apps packages.</p>
|
||||
<p>Four components builds up a General Bot App:</p>
|
||||
<ul>
|
||||
<li>dialogs</li>
|
||||
<li>models</li>
|
||||
<li>services</li>
|
||||
<li>tests</li>
|
||||
</ul>
|
||||
<h4 id="dialogs">Dialogs</h4>
|
||||
<p>All code contained in a dialog builds the flow to custom conversations in
|
||||
built-in and additional packages .</p>
|
||||
<h4 id="models">Models</h4>
|
||||
<p>Models builds the foundation of data relationships in form of entities.</p>
|
||||
<h4 id="services">Services</h4>
|
||||
<p>Services are a façade for bot back-end logic and other custom processing.</p>
|
||||
<h4 id="tests">Tests</h4>
|
||||
<p>Tests try to automate code execution validation before crashing in production.</p>
|
||||
<h3 id="-gbot">.gbot</h3>
|
||||
<p>An expression of an artificial inteligence entity. A .gbot file defines
|
||||
all bots dependencies related to services and other resources.</p>
|
||||
<h3 id="-gbtheme">.gbtheme</h3>
|
||||
<p>A theme of a bot at a given time. CSS files & images that can compose all UI
|
||||
presentation and using it a branding can be done. <a href="https://github.com/pragmatismo-io/Office365.gbtheme">A sample .gbtheme is available</a></p>
|
||||
<h3 id="-gbkb">.gbkb</h3>
|
||||
<p>A set of subjects that bot knows in a form of hierarchical menu-based QnA. <a href="https://github.com/pragmatismo-io/ProjectOnline.gbkb">A sample .gbkb is available</a>.</p>
|
||||
<h3 id="-gblib">.gblib</h3>
|
||||
<p>Shared code that can be used across bot apps.</p>
|
||||
<h2 id="reference">Reference</h2>
|
||||
<h3 id="generalbots-admin-commands">GeneralBots admin commands</h3>
|
||||
<p>General Bot can be controlled by the same chat window people talk to, so
|
||||
here is a list of admin commands related to deploying .gb* files.</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Command</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td>deployPackage</td>
|
||||
<td>Deploy a KB package. Usage <strong>deployPackage</strong> [package-name]. Then, you need to run rebuildIndex.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>undeployPackage</td>
|
||||
<td>Undeploy a KB. Usage <strong>undeployPackage</strong> [package-name].</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>redeployPackage</td>
|
||||
<td>Undeploy and then deploys the KB. Usage <strong>redeployPackage</strong> [package-name]. Then, you need to run rebuildIndex.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>setupSecurity</td>
|
||||
<td>Setup connection to user directories.</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<p>Discontinued commands:</p>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Command</th>
|
||||
<th>Description</th>
|
||||
<th>Reason</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td>rebuildIndex</td>
|
||||
<td>Rebuild Azure Search indexes, must be run after <strong>deployPackage</strong> or <strong>redeployPackage</strong>.</td>
|
||||
<td>Now it is called automatically</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
<h3 id="credits-inspiration">Credits & Inspiration</h3>
|
||||
<ul>
|
||||
<li>Rodrigo Rodriguez (<a href="mailto:me@rodrigorodriguez.com">me@rodrigorodriguez.com</a>) - Coding, Docs & Architecture.</li>
|
||||
<li>David Lerner (<a href="mailto:david.lerner@hotmail.com">david.lerner@hotmail.com</a>) - UI, UX & Theming.</li>
|
||||
<li>Eduardo Romeiro (<a href="mailto:eromeirosp@outlook.com">eromeirosp@outlook.com</a>) - Content & UX.</li>
|
||||
<li>Jorge Ramos (<a href="mailto:jramos@pobox.com">jramos@pobox.com</a>) - Coding, Docs & Architecture.</li>
|
||||
<li>PH Nascimento (<a href="mailto:ph.an@outlook.com">ph.an@outlook.com</a>) - Product Manager</li>
|
||||
</ul>
|
||||
<p>Powered by Microsoft <a href="https://dev.botframework.com/">BOT Framework</a> and <a href="http://www.azure.com">Azure</a>.</p>
|
||||
<p>General Bot Code Name is <a href="https://en.wikipedia.org/wiki/Guaribas">Guaribas</a>, the name of a city in Brasil, state of Piaui.
|
||||
<a href="http://www.robertounger.com/en/">Roberto Mangabeira Unger</a>: "No one should have to do work that can be done by a machine".</p>
|
||||
<h2 id="contributing">Contributing</h2>
|
||||
<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>
|
||||
<h2 id="reporting-security-issues">Reporting Security Issues</h2>
|
||||
<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 & Warranty</h1>
|
||||
</a>
|
||||
<h2 id="license-warranty">License & Warranty</h2>
|
||||
<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
|
||||
|
@ -163,27 +339,152 @@
|
|||
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> <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>: "No one should have to do work that can be done by a machine".</p>
|
||||
<p><a href="https://stackoverflow.com/questions/ask?tags=generalbots">:speech_balloon: Ask a question</a> <a href="/docs">:book: Read the Docs</a></p>
|
||||
</h2>
|
||||
</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">"src/app"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module">
|
||||
<a href="modules/_src_logger_.html">"src/logger"</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">"packages/admin.gbapp/dialogs/<wbr>Admin<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_index_.html">"packages/admin.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_models_adminmodel_.html">"packages/admin.gbapp/models/<wbr>Admin<wbr>Model"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_services_gbadminservice_.html">"packages/admin.gbapp/services/GBAdmin<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_admin_gbapp_strings_.html">"packages/admin.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_analytics_gblib_index_.html">"packages/analytics.gblib/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_analytics_gblib_models_index_.html">"packages/analytics.gblib/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_azuredeployer_gbapp_services_azuredeployerservice_.html">"packages/azuredeployer.gbapp/services/<wbr>Azure<wbr>Deployer<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_dialogs_welcomedialog_.html">"packages/core.gbapp/dialogs/<wbr>Welcome<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_dialogs_whoamidialog_.html">"packages/core.gbapp/dialogs/<wbr>Who<wbr>AmIDialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_index_.html">"packages/core.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_models_gbmodel_.html">"packages/core.gbapp/models/GBModel"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbapiservice_.html">"packages/core.gbapp/services/GBAPIService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbconfigservice_.html">"packages/core.gbapp/services/GBConfig<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbconversationalservice_.html">"packages/core.gbapp/services/GBConversational<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbcoreservice_.html">"packages/core.gbapp/services/GBCore<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbdeployer_.html">"packages/core.gbapp/services/GBDeployer"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbimporterservice_.html">"packages/core.gbapp/services/GBImporter<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbminservice_.html">"packages/core.gbapp/services/GBMin<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_gbvmservice_.html">"packages/core.gbapp/services/GBVMService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_services_tscompiler_.html">"packages/core.gbapp/services/TSCompiler"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_core_gbapp_strings_.html">"packages/core.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_feedbackdialog_.html">"packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Feedback<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_dialogs_qualitydialog_.html">"packages/customer-<wbr>satisfaction.gbapp/dialogs/<wbr>Quality<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_index_.html">"packages/customer-<wbr>satisfaction.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_models_index_.html">"packages/customer-<wbr>satisfaction.gbapp/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_services_csservice_.html">"packages/customer-<wbr>satisfaction.gbapp/services/CSService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_customer_satisfaction_gbapp_strings_.html">"packages/customer-<wbr>satisfaction.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_dialogs_askdialog_.html">"packages/kb.gbapp/dialogs/<wbr>Ask<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_dialogs_faqdialog_.html">"packages/kb.gbapp/dialogs/<wbr>Faq<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_dialogs_menudialog_.html">"packages/kb.gbapp/dialogs/<wbr>Menu<wbr>Dialog"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_index_.html">"packages/kb.gbapp/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_models_index_.html">"packages/kb.gbapp/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_services_kbservice_.html">"packages/kb.gbapp/services/KBService"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_kb_gbapp_strings_.html">"packages/kb.gbapp/strings"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_security_gblib_index_.html">"packages/security.gblib/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_security_gblib_models_index_.html">"packages/security.gblib/models/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_security_gblib_services_secservice_.html">"packages/security.gblib/services/<wbr>Sec<wbr>Service"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_whatsapp_gblib_index_.html">"packages/whatsapp.gblib/index"</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-external-module tsd-is-external">
|
||||
<a href="modules/_packages_whatsapp_gblib_services_whatsappdirectline_.html">"packages/whatsapp.gblib/services/<wbr>Whatsapp<wbr>Direct<wbr>Line"</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,20 +495,65 @@
|
|||
<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>
|
||||
</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>
|
||||
</footer>
|
||||
<div class="container tsd-generator">
|
||||
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
|
||||
<p>Generated using <a href="http://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>
|
234
docs/reference/modules/_src_app_.html
Normal file
|
@ -0,0 +1,234 @@
|
|||
<!doctype html>
|
||||
<html class="default no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>"src/app" | 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">"src/app"</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h1>External module "src/app"</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>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>
|
||||
</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#apppackages" class="tsd-kind-icon">app<wbr>Packages</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#logger" class="tsd-kind-icon">logger</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="apppackages" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagConst">Const</span> app<wbr>Packages</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">app<wbr>Packages<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> = new Array<IGBPackage>()</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/app.ts#L55">src/app.ts:55</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"> = require('body-parser')</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/app.ts#L42">src/app.ts:42</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"> = require('express')</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/app.ts#L41">src/app.ts:41</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="logger" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagConst">Const</span> logger</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">logger<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = require('./logger')</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/app.ts#L40">src/app.ts:40</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">"src/app"</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-variable tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a href="_src_app_.html#apppackages" class="tsd-kind-icon">app<wbr>Packages</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#logger" class="tsd-kind-icon">logger</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>
|
||||
</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="http://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>
|
464
docs/reference/modules/_src_logger_.html
Normal file
|
@ -0,0 +1,464 @@
|
|||
<!doctype html>
|
||||
<html class="default no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>"src/logger" | 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_logger_.html">"src/logger"</a>
|
||||
</li>
|
||||
</ul>
|
||||
<h1>External module "src/logger"</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>\
|
||||
| ( )_ _ |
|
||||
| _ _ _ <em>_ _ _ __ <strong>_ _</strong> _ _ | ,</em>)(<em>) <strong>_ _</strong> _ |
|
||||
| ( '</em><code>\ ( '__)/'_</code> ) /'_ <code>\/' _</code> _ <code>\ /'_</code> )| | | |/',<strong>)/' _ <code>\ /'_</code>\ |
|
||||
| | (<em>) )| | ( (</em>| |( (<em>) || ( ) ( ) |( (</em>| || |_ | |\</strong>, | ( ) |( (<em>) ) |
|
||||
| | ,__/'(</em>) <code>\__,_)</code>__ |(<em>) (</em>) (<em>)`__,</em>)<code>\__)(_)(____/(_) (_)</code>_<strong>/' |
|
||||
| | | ( )<em>) | |
|
||||
| (</em>) _</strong>/' |
|
||||
| |
|
||||
| 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. |
|
||||
| |
|
||||
\</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 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_logger_.html#createlogger" class="tsd-kind-icon">create<wbr>Logger</a></li>
|
||||
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_logger_.html#format" class="tsd-kind-icon">format</a></li>
|
||||
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_logger_.html#logger" class="tsd-kind-icon">logger</a></li>
|
||||
<li class="tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_logger_.html#transports" class="tsd-kind-icon">transports</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="tsd-index-section tsd-is-not-exported">
|
||||
<h3>Object literals</h3>
|
||||
<ul class="tsd-index-list">
|
||||
<li class="tsd-kind-object-literal tsd-parent-kind-external-module tsd-is-not-exported"><a href="_src_logger_.html#config" class="tsd-kind-icon">config</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="createlogger" class="tsd-anchor"></a>
|
||||
<h3>create<wbr>Logger</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">create<wbr>Logger<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L37">src/logger.ts:37</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="format" class="tsd-anchor"></a>
|
||||
<h3>format</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">format<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L37">src/logger.ts:37</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="logger" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagConst">Const</span> logger</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">logger<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = createLogger({format: format.combine(format.colorize(),format.simple(),format.label({ label: 'GeneralBots' }),format.timestamp(),format.printf(nfo => {return `${nfo.timestamp} [${nfo.label}] ${nfo.level}: ${nfo.message}`;})),levels: config.levels,transports: [new transports.Console()]})</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L62">src/logger.ts:62</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="transports" class="tsd-anchor"></a>
|
||||
<h3>transports</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">transports<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L37">src/logger.ts:37</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
</section>
|
||||
<section class="tsd-panel-group tsd-member-group tsd-is-not-exported">
|
||||
<h2>Object literals</h2>
|
||||
<section class="tsd-panel tsd-member tsd-kind-object-literal tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a name="config" class="tsd-anchor"></a>
|
||||
<h3><span class="tsd-flag ts-flagConst">Const</span> config</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">config<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L39">src/logger.ts:39</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
<section class="tsd-panel tsd-member tsd-kind-object-literal tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors" class="tsd-anchor"></a>
|
||||
<h3>colors</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">colors<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L50">src/logger.ts:50</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.custom" class="tsd-anchor"></a>
|
||||
<h3>custom</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">custom<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "yellow"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L58">src/logger.ts:58</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.data" class="tsd-anchor"></a>
|
||||
<h3>data</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">data<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "grey"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L54">src/logger.ts:54</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.debug" class="tsd-anchor"></a>
|
||||
<h3>debug</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "blue"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L52">src/logger.ts:52</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.error" class="tsd-anchor"></a>
|
||||
<h3>error</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">error<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "red"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L51">src/logger.ts:51</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.info" class="tsd-anchor"></a>
|
||||
<h3>info</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">info<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "green"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L55">src/logger.ts:55</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.silly" class="tsd-anchor"></a>
|
||||
<h3>silly</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">silly<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "magenta"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L57">src/logger.ts:57</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.verbose" class="tsd-anchor"></a>
|
||||
<h3>verbose</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">verbose<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "cyan"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L56">src/logger.ts:56</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.colors.warn" class="tsd-anchor"></a>
|
||||
<h3>warn</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">warn<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "yellow"</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L53">src/logger.ts:53</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-object-literal tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels" class="tsd-anchor"></a>
|
||||
<h3>levels</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">levels<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L40">src/logger.ts:40</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.custom-1" class="tsd-anchor"></a>
|
||||
<h3>custom</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">custom<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 7</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L48">src/logger.ts:48</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.data-1" class="tsd-anchor"></a>
|
||||
<h3>data</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">data<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 3</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L44">src/logger.ts:44</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.debug-1" class="tsd-anchor"></a>
|
||||
<h3>debug</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">debug<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 1</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L42">src/logger.ts:42</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.error-1" class="tsd-anchor"></a>
|
||||
<h3>error</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">error<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 0</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L41">src/logger.ts:41</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.info-1" class="tsd-anchor"></a>
|
||||
<h3>info</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">info<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 4</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L45">src/logger.ts:45</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.silly-1" class="tsd-anchor"></a>
|
||||
<h3>silly</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">silly<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 6</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L47">src/logger.ts:47</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.verbose-1" class="tsd-anchor"></a>
|
||||
<h3>verbose</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">verbose<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 5</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L46">src/logger.ts:46</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-object-literal tsd-is-not-exported">
|
||||
<a name="config.levels.warn-1" class="tsd-anchor"></a>
|
||||
<h3>warn</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">warn<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 2</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in <a href="https://github.com/rodrigorodriguez/BotServer/blob/8490f5e/src/logger.ts#L43">src/logger.ts:43</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
</section>
|
||||
</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_logger_.html">"src/logger"</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<nav class="tsd-navigation secondary menu-sticky">
|
||||
<ul class="before-current">
|
||||
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a href="_src_logger_.html#createlogger" class="tsd-kind-icon">create<wbr>Logger</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a href="_src_logger_.html#format" class="tsd-kind-icon">format</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a href="_src_logger_.html#logger" class="tsd-kind-icon">logger</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a href="_src_logger_.html#transports" class="tsd-kind-icon">transports</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-object-literal tsd-parent-kind-external-module tsd-is-not-exported">
|
||||
<a href="_src_logger_.html#config" class="tsd-kind-icon">config</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>
|
||||
</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="http://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>
|
382
extensions.json
|
@ -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"
|
||||
}
|
||||
]
|
17
gbot.cmd
|
@ -1,15 +1,2 @@
|
|||
@ECHO off
|
||||
|
||||
ECHO General Bots Command Line
|
||||
|
||||
IF EXIST node_modules goto COMPILE
|
||||
ECHO Installing Packages for the first time use (it may take several minutes)...
|
||||
CALL npm install --silent
|
||||
|
||||
:COMPILE
|
||||
IF EXIST dist goto ALLSET
|
||||
ECHO Compiling...
|
||||
npm run build
|
||||
|
||||
:ALLSET
|
||||
npm run start
|
||||
@echo off
|
||||
node dist/src/app.js
|
||||
|
|
2
gbot.sh
|
@ -1,2 +0,0 @@
|
|||
echo Starting General Bots...
|
||||
npm run start
|
11
greenkeeper.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"groups": {
|
||||
"default": {
|
||||
"packages": [
|
||||
"package.json",
|
||||
"packages/default.gbtheme/package.json",
|
||||
"packages/default.gbui/package.json"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
BIN
logo.png
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 7.6 KiB |
64442
package-lock.json
generated
356
package.json
|
@ -1,52 +1,44 @@
|
|||
{
|
||||
"name": "botserver",
|
||||
"version": "5.0.0",
|
||||
"version": "1.2.1",
|
||||
"description": "General Bot Community Edition open-core server.",
|
||||
"main": "./boot.mjs",
|
||||
"type": "module",
|
||||
"main": "./src/app.ts",
|
||||
"bugs": "https://github.com/pragmatismo-io/BotServer/issues",
|
||||
"homepage": "https://github.com/pragmatismo-io/BotServer/#readme",
|
||||
"contributors": [
|
||||
"Rodrigo Rodriguez <me@rodrigorodriguez.com>",
|
||||
"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>"
|
||||
"Jorge Ramos <jramos@pobox.com>"
|
||||
],
|
||||
"opencv4nodejs": {
|
||||
"disableAutoBuild": "1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "=22.9.0"
|
||||
"node": "=10.13.0"
|
||||
},
|
||||
"license": "AGPL-3.0",
|
||||
"preferGlobal": true,
|
||||
"private": false,
|
||||
"bin": {
|
||||
"gbot": "./boot.mjs"
|
||||
"gbot": "./dist/src/app.js"
|
||||
},
|
||||
"readme": "README.md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/GeneralBots/BotServer.git"
|
||||
"url": "https://github.com/pragmatismo-io/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",
|
||||
"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",
|
||||
"reverse-proxy": "node_modules/.bin/ngrok http 4242",
|
||||
"test": "nyc --reporter=html --reporter=text mocha -r ts-node/register packages/**/*.test.ts ",
|
||||
"pretest": "npm run build",
|
||||
"coveralls": "npm run test && nyc report --reporter=text-lcov | coveralls",
|
||||
"start": "node ./dist/src/app.js",
|
||||
"watch:build": "tsc --watch",
|
||||
"watch:server": "nodemon './dist/index.js' --watch './dist'",
|
||||
"posttypedoc": "shx cp .nojekyll docs/reference/.nojekyll",
|
||||
"ban": "ban",
|
||||
"issues": "git-issues",
|
||||
"license": "license-checker --production --onlyunknown --csv",
|
||||
"pretslint": "npm run pretty",
|
||||
"pretty": "prettier-standard 'src/*.ts' 'packages/**/*.ts'",
|
||||
"secure": "nsp check",
|
||||
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
|
||||
|
@ -55,226 +47,101 @@
|
|||
"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",
|
||||
"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",
|
||||
"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",
|
||||
"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",
|
||||
"dotenv-extended": "2.9.0",
|
||||
"electron": "32.0.1",
|
||||
"exceljs": "4.4.0",
|
||||
"express": "4.19.2",
|
||||
"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",
|
||||
"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",
|
||||
"readline": "1.3.0",
|
||||
"reflect-metadata": "0.2.2",
|
||||
"rimraf": "6.0.1",
|
||||
"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",
|
||||
"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",
|
||||
"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",
|
||||
"@microsoft/microsoft-graph-client": "1.3.0",
|
||||
"@semantic-release/exec": "^3.3.0",
|
||||
"adal-node": "0.1.28",
|
||||
"async": "2.6.1",
|
||||
"async-promises": "0.2.1",
|
||||
"azure-arm-cognitiveservices": "2.4.0",
|
||||
"azure-arm-resource": "7.2.1",
|
||||
"azure-arm-search": "^1.3.0-preview",
|
||||
"azure-arm-sql": "5.6.0",
|
||||
"azure-arm-website": "5.7.0",
|
||||
"bluebird": "^3.5.3",
|
||||
"body-parser": "1.18.3",
|
||||
"botbuilder": "^4.1.7",
|
||||
"botbuilder-ai": "^4.1.7",
|
||||
"botbuilder-azure": "^4.1.7",
|
||||
"botbuilder-choices": "^4.0.0-preview1.2",
|
||||
"botbuilder-dialogs": "^4.1.7",
|
||||
"botbuilder-prompts": "^4.0.0-preview1.2",
|
||||
"botlib": "^0.1.8",
|
||||
"chai": "4.2.0",
|
||||
"child_process": "^1.0.2",
|
||||
"chokidar": "2.0.4",
|
||||
"cli-spinner": "^0.2.8",
|
||||
"csv-parse": "4.1.0",
|
||||
"dotenv-extended": "2.3.0",
|
||||
"express": "4.16.4",
|
||||
"express-promise-router": "3.0.3",
|
||||
"fs-extra": "7.0.1",
|
||||
"fs-walk": "0.0.2",
|
||||
"ip": "^1.1.5",
|
||||
"localize": "0.4.7",
|
||||
"marked": "0.5.2",
|
||||
"mocha": "5.2.0",
|
||||
"mocha-typescript": "1.1.17",
|
||||
"ms": "2.1.1",
|
||||
"ms-rest-azure": "2.5.9",
|
||||
"nexmo": "2.4.0",
|
||||
"ngrok": "^3.1.0",
|
||||
"nyc": "^13.1.0",
|
||||
"opn": "^5.4.0",
|
||||
"pragmatismo-io-framework": "1.0.19",
|
||||
"process-exists": "^3.1.0",
|
||||
"public-ip": "^2.4.0",
|
||||
"reflect-metadata": "0.1.12",
|
||||
"request-promise-native": "1.0.5",
|
||||
"scanf": "^1.0.2",
|
||||
"sequelize": "4.41.2",
|
||||
"sequelize-typescript": "0.6.6",
|
||||
"shx": "^0.3.2",
|
||||
"simple-git": "^1.107.0",
|
||||
"sqlite3": "4.0.4",
|
||||
"strict-password-generator": "^1.1.1",
|
||||
"swagger-client": "3.8.22",
|
||||
"tedious": "3.0.1",
|
||||
"ts-node": "7.0.1",
|
||||
"typedoc": "0.13.0",
|
||||
"typedoc-plugin-external-module-name": "^1.1.3",
|
||||
"typedoc-plugin-markdown": "^1.1.19",
|
||||
"typescript": "3.2.1",
|
||||
"url-join": "4.0.0",
|
||||
"vbscript-to-typescript": "^1.0.8",
|
||||
"wait-until": "0.0.2",
|
||||
"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"
|
||||
"winston": "3.1.0"
|
||||
},
|
||||
"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",
|
||||
"cz-conventional-changelog": "3.3.0",
|
||||
"dependency-check": "4.1.0",
|
||||
"@semantic-release/changelog": "^3.0.1",
|
||||
"@semantic-release/commit-analyzer": "^6.1.0",
|
||||
"@semantic-release/git": "^7.0.5",
|
||||
"@semantic-release/github": "^5.2.5",
|
||||
"@semantic-release/npm": "^5.1.1",
|
||||
"@semantic-release/release-notes-generator": "^7.1.4",
|
||||
"@types/chai": "4.1.7",
|
||||
"@types/mocha": "5.2.5",
|
||||
"@types/sequelize": "4.27.32",
|
||||
"@types/url-join": "0.8.2",
|
||||
"@types/winston": "2.4.4",
|
||||
"ban-sensitive-files": "1.9.2",
|
||||
"commitizen": "^3.0.4",
|
||||
"coveralls": "^3.0.2",
|
||||
"cz-conventional-changelog": "^2.1.0",
|
||||
"dependency-check": "3.2.1",
|
||||
"deps-ok": "1.4.1",
|
||||
"git-issues": "1.3.1",
|
||||
"license-checker": "25.0.1",
|
||||
"prettier-standard": "16.4.1",
|
||||
"semantic-release": "24.1.0",
|
||||
"simple-commit-message": "4.1.3",
|
||||
"travis-deploy-once": "5.0.11",
|
||||
"tslint": "6.1.3",
|
||||
"tsx": "^4.19.1",
|
||||
"vitest": "2.0.5"
|
||||
"license-checker": "25.0.0",
|
||||
"nsp": "3.2.1",
|
||||
"pre-git": "3.17.1",
|
||||
"prettier-standard": "8.0.1",
|
||||
"semantic-release": "^15.12.4",
|
||||
"standard": "12.0.1",
|
||||
"travis-deploy-once": "5.0.9",
|
||||
"ts-loader": "^5.3.1",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-microsoft-contrib": "^6.0.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
|
@ -324,9 +191,6 @@
|
|||
"release": {
|
||||
"tagFormat": "${version}",
|
||||
"debug": true,
|
||||
"branches": [
|
||||
"main"
|
||||
],
|
||||
"verifyConditions": [
|
||||
"@semantic-release/github"
|
||||
],
|
||||
|
@ -362,8 +226,18 @@
|
|||
},
|
||||
"pre-git": {
|
||||
"commit-msg": "simple",
|
||||
"pre-commit": [],
|
||||
"pre-push": [],
|
||||
"pre-commit": [
|
||||
"npm prune",
|
||||
"git add packages/*.ts",
|
||||
"npm run ban"
|
||||
],
|
||||
"pre-push": [
|
||||
"echo skip npm run unused-deps",
|
||||
"echo skip npm npm run secure",
|
||||
"echo skip npm run license",
|
||||
"echo skip npm run ban -- --all",
|
||||
"echo skip run size"
|
||||
],
|
||||
"post-commit": [],
|
||||
"post-checkout": [],
|
||||
"post-merge": []
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,434 +36,149 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import crypto from 'crypto';
|
||||
import urlJoin from 'url-join';
|
||||
const UrlJoin = require('url-join');
|
||||
import { BotAdapter } from 'botbuilder';
|
||||
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 { 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';
|
||||
import { GBMinInstance } from 'botlib';
|
||||
import { IGBDialog } from 'botlib';
|
||||
import { GBConfigService } from '../../core.gbapp/services/GBConfigService';
|
||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer';
|
||||
import { GBImporter } from '../../core.gbapp/services/GBImporterService';
|
||||
import { GBAdminService } from '../services/GBAdminService';
|
||||
import { Messages } from '../strings';
|
||||
|
||||
/**
|
||||
* Dialogs for administration tasks.
|
||||
*/
|
||||
export class AdminDialog extends IGBDialog {
|
||||
public static async createFarmCommand(text: any, min: GBMinInstance) {}
|
||||
|
||||
class AdminDialog extends IGBDialog {
|
||||
public static isIntentYes(locale, utterance) {
|
||||
return utterance.toLowerCase().match(Messages[locale].affirmative_sentences);
|
||||
}
|
||||
|
||||
public static isIntentNo(locale, utterance) {
|
||||
return utterance.toLowerCase().match(Messages[locale].negative_sentences);
|
||||
}
|
||||
|
||||
public static setup(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);
|
||||
await deployer.undeployPackageFromLocalPath(min.instance, UrlJoin('packages', packageName));
|
||||
}
|
||||
|
||||
AdminDialog.setupSecurityDialogs(min);
|
||||
public static async deployPackageCommand(min: GBMinInstance, text: string, deployer: GBDeployer) {
|
||||
const packageName = text.split(' ')[1];
|
||||
const additionalPath = GBConfigService.get('ADDITIONAL_DEPLOY_PATH');
|
||||
if (!additionalPath)
|
||||
{
|
||||
throw new Error('ADDITIONAL_DEPLOY_PATH is not set and deployPackage was called.');
|
||||
}
|
||||
await deployer.deployPackageFromLocalPath(min, UrlJoin(additionalPath, packageName));
|
||||
}
|
||||
|
||||
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;
|
||||
public static async rebuildIndexPackageCommand(min: GBMinInstance, text: string, deployer: GBDeployer) {
|
||||
await deployer.rebuildIndex(min.instance);
|
||||
}
|
||||
|
||||
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'];
|
||||
public static async addConnectionCommand(min: GBMinInstance, text: any) {
|
||||
const packageName = text.split(' ')[1];
|
||||
const importer = new GBImporter(min.core);
|
||||
const admin = new GBAdminService(min.core);
|
||||
// TODO: await admin.addConnection
|
||||
}
|
||||
|
||||
if (await GBUtil.comparePassword( sensitive, min.instance.adminPass)) {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].welcome);
|
||||
|
||||
return await step.endDialog(true);
|
||||
} else {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].wrong_password);
|
||||
return await step.replaceDialog('/admin-auth');
|
||||
}
|
||||
}
|
||||
])
|
||||
);
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
*
|
||||
* @param bot The bot adapter.
|
||||
* @param min The minimal bot instance data.
|
||||
*/
|
||||
public static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
// Setup services.
|
||||
|
||||
const importer = new GBImporter(min.core);
|
||||
const deployer = new GBDeployer(min.core, importer);
|
||||
|
||||
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);
|
||||
return await step.prompt('textPrompt', 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 password = step.result;
|
||||
|
||||
if (await GBUtil.comparePassword( sensitive, min.instance.adminPass)) {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].welcome);
|
||||
if (password === GBConfigService.get('ADMIN_PASS')) {
|
||||
await step.context.sendActivity(Messages[locale].welcome);
|
||||
|
||||
return await min.conversationalService.prompt(min, step, Messages[locale].which_task);
|
||||
return await step.prompt('textPrompt', Messages[locale].which_task);
|
||||
} else {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].wrong_password);
|
||||
await step.context.sendActivity(Messages[locale].wrong_password);
|
||||
|
||||
return await step.endDialog();
|
||||
}
|
||||
},
|
||||
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'];
|
||||
const locale = step.context.activity.locale;
|
||||
const text = step.result;
|
||||
const cmdName = text.split(' ')[0];
|
||||
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].working(cmdName));
|
||||
step.context.sendActivity(Messages[locale].working(cmdName));
|
||||
let unknownCommand = false;
|
||||
|
||||
try {
|
||||
if (text === 'quit') {
|
||||
return await step.replaceDialog('/');
|
||||
} else if (cmdName === 'setupSecurity') {
|
||||
return await step.beginDialog('/setupSecurity');
|
||||
} else {
|
||||
unknownCommand = true;
|
||||
}
|
||||
if (text === 'quit') {
|
||||
return await step.replaceDialog('/');
|
||||
} else if (cmdName === 'createFarm') {
|
||||
await AdminDialog.createFarmCommand(text, deployer);
|
||||
|
||||
if (unknownCommand) {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].unknown_command);
|
||||
} else {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].finished_working);
|
||||
}
|
||||
} catch (error) {
|
||||
await min.conversationalService.sendText(min, step, error.message ? error.message : error);
|
||||
}
|
||||
await step.replaceDialog('/ask', { isReturning: true });
|
||||
}
|
||||
])
|
||||
);
|
||||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'deployPackage') {
|
||||
await AdminDialog.deployPackageCommand(min, text, deployer);
|
||||
|
||||
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');
|
||||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'redeployPackage') {
|
||||
await AdminDialog.undeployPackageCommand(text, min);
|
||||
await AdminDialog.deployPackageCommand(min, text, deployer);
|
||||
|
||||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'rebuildIndex') {
|
||||
await AdminDialog.rebuildIndexPackageCommand(min, text, deployer);
|
||||
|
||||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'addConnection') {
|
||||
await AdminDialog.addConnectionCommand(min, text);
|
||||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'undeployPackage') {
|
||||
await AdminDialog.undeployPackageCommand(text, min);
|
||||
|
||||
return await step.replaceDialog('/admin', { firstRun: false });
|
||||
} else if (cmdName === 'setupSecurity') {
|
||||
await AdminDialog.setupSecurity(min, step);
|
||||
} else {
|
||||
return await step.next(step.options);
|
||||
unknownCommand = true;
|
||||
}
|
||||
},
|
||||
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');
|
||||
|
||||
if (unknownCommand) {
|
||||
await step.context.sendActivity(Messages[locale].unknown_command);
|
||||
} else {
|
||||
const locale = step.context.activity.locale;
|
||||
return await min.conversationalService.prompt(min, step, Messages[locale].publish_type_yes);
|
||||
await step.context.sendActivity(Messages[locale].finshed_working(cmdName));
|
||||
}
|
||||
},
|
||||
async step => {
|
||||
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
|
||||
const locale = step.context.activity.locale;
|
||||
await step.endDialog();
|
||||
|
||||
if (AdminDialog.isIntentYes(locale, step.result)) {
|
||||
const list = min.core.getParam(min.instance, '.gbapp List', null);
|
||||
const items = list ? list.split(';') : [];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].publish_canceled);
|
||||
}
|
||||
}
|
||||
])
|
||||
);
|
||||
|
||||
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') {
|
||||
return await step.next('sim');
|
||||
} else {
|
||||
const locale = step.context.activity.locale;
|
||||
return await min.conversationalService.prompt(min, step, Messages[locale].publish_type_yes);
|
||||
}
|
||||
},
|
||||
async step => {
|
||||
min = GBServer.globals.minInstances.find(p => p.botId === min.botId);
|
||||
const locale = step.context.activity.locale;
|
||||
|
||||
if (AdminDialog.isIntentYes(locale, step.result)) {
|
||||
let from = step.context.activity.from.id;
|
||||
|
||||
let canPublish: Boolean;
|
||||
if (step.activeDialog.state.options.firstTime) {
|
||||
canPublish = true;
|
||||
} else {
|
||||
canPublish = AdminDialog.canPublish(min, from) || process.env.ADMIN_OPEN_PUBLISH === 'true';
|
||||
}
|
||||
|
||||
if (!canPublish) {
|
||||
await step.beginDialog('/admin-auth');
|
||||
} else {
|
||||
await step.next(true);
|
||||
}
|
||||
} else {
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].publish_canceled);
|
||||
}
|
||||
},
|
||||
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);
|
||||
|
||||
return step.endDialog();
|
||||
}
|
||||
|
||||
const botId = min.instance.botId;
|
||||
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].working('Publishing'));
|
||||
|
||||
step.activeDialog.state.options.args = (step.options as any).args;
|
||||
const filename = step.activeDialog.state.options.args
|
||||
? step.activeDialog.state.options.args.split(' ')[0]
|
||||
: null;
|
||||
|
||||
const packages = [];
|
||||
let skipError = false;
|
||||
if (!filename || 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}.gbdialog`);
|
||||
skipError = true;
|
||||
} else {
|
||||
packages.push(filename);
|
||||
}
|
||||
|
||||
await CollectionUtil.asyncForEach(packages, async packageName => {
|
||||
let cmd1;
|
||||
|
||||
if (
|
||||
packageName.toLowerCase() === 'gbdialog' ||
|
||||
packageName.toLowerCase() === 'gbdrive' ||
|
||||
packageName.toLowerCase() === 'gbdata' ||
|
||||
packageName.toLowerCase() === 'gbkb' ||
|
||||
packageName.toLowerCase() === 'gbot' ||
|
||||
packageName.toLowerCase() === 'gbtheme'
|
||||
) {
|
||||
packageName = `${min.botId}.${packageName}`;
|
||||
}
|
||||
|
||||
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.`);
|
||||
|
||||
if (!step.activeDialog.state.options.confirm) {
|
||||
return await step.replaceDialog('/ask', { isReturning: true });
|
||||
} else {
|
||||
return await step.endDialog();
|
||||
}
|
||||
return await step.replaceDialog('/answer', { query: text });
|
||||
}
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
public static canPublish(min: GBMinInstance, phone: string): Boolean {
|
||||
if (process.env.SECURITY_CAN_PUBLISH !== undefined) {
|
||||
let list = process.env.SECURITY_CAN_PUBLISH.split(';');
|
||||
private static async setupSecurity(min: any, step: any) {
|
||||
const locale = step.activity.locale;
|
||||
const state = `${min.instance.instanceId}${Math.floor(Math.random() * 1000000000)}`;
|
||||
await min.adminService.setValue(min.instance.instanceId, 'AntiCSRFAttackState', state);
|
||||
const url = `https://login.microsoftonline.com/${min.instance.authenticatorTenant}/oauth2/authorize?client_id=${
|
||||
min.instance.authenticatorClientId
|
||||
}&response_type=code&redirect_uri=${min.instance.botEndpoint}/${
|
||||
min.instance.botId
|
||||
}/token&state=${state}&response_mode=query`;
|
||||
|
||||
const canPublish = min.core.getParam(min.instance, 'Can Publish', null);
|
||||
if (canPublish) {
|
||||
list = list.concat(canPublish.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 result;
|
||||
}
|
||||
}
|
||||
|
||||
private static setupSecurityDialogs(min: GBMinInstance) {
|
||||
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'];
|
||||
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'];
|
||||
|
||||
const tokenName = step.activeDialog.state.tokenName;
|
||||
|
||||
if (!tokenName) {
|
||||
min.instance.authenticatorAuthorityHostUrl = step.activeDialog.state.authenticatorAuthorityHostUrl;
|
||||
min.instance.authenticatorTenant = step.activeDialog.state.authenticatorTenant;
|
||||
|
||||
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);
|
||||
|
||||
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`;
|
||||
|
||||
await min.conversationalService.sendText(min, step, Messages[locale].consent(url));
|
||||
|
||||
return await step.replaceDialog('/ask', { isReturning: true });
|
||||
}
|
||||
])
|
||||
);
|
||||
await step.sendActivity(Messages[locale].consent(url));
|
||||
}
|
||||
}
|
||||
|
||||
export { AdminDialog };
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,40 +36,21 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
import urlJoin = require('url-join');
|
||||
|
||||
import { 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.
|
||||
*/
|
||||
export class GBAdminPackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[];
|
||||
public sysPackages: IGBPackage[] = null;
|
||||
|
||||
public async getDialogs (min: GBMinInstance) {
|
||||
GBLogEx.verbose(min,`getDialogs called.`);
|
||||
}
|
||||
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 onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
|
||||
GBLogEx.verbose(min, `onNewSession called.`);
|
||||
}
|
||||
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
|
||||
GBLogEx.verbose(min,`onExchangeData called.`);
|
||||
}
|
||||
|
||||
public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
|
||||
core.sequelize.addModels([GuaribasAdmin]);
|
||||
}
|
||||
|
||||
public async loadBot (min: GBMinInstance): Promise<void> {
|
||||
AdminDialog.setup(min);
|
||||
public loadBot(min: GBMinInstance): void {
|
||||
AdminDialog.setup(min.bot, min);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,31 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { Column, CreatedAt, DataType, Model, Table, UpdatedAt } from 'sequelize-typescript';
|
||||
import {
|
||||
Column,
|
||||
CreatedAt,
|
||||
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(DataType.STRING(4000))
|
||||
declare value: string;
|
||||
@Column
|
||||
public key: string;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@Column
|
||||
public value: string;
|
||||
|
||||
@Column
|
||||
@CreatedAt
|
||||
declare createdAt: Date;
|
||||
public createdAt: Date;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@Column
|
||||
@UpdatedAt
|
||||
declare updatedAt: Date;
|
||||
public updatedAt: Date;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,35 +37,20 @@
|
|||
'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 { IGBCoreService } from 'botlib';
|
||||
import { GuaribasAdmin } from '../models/AdminModel';
|
||||
const UrlJoin = require('url-join');
|
||||
const msRestAzure = require('ms-rest-azure');
|
||||
const PasswordGenerator = require('strict-password-generator').default;
|
||||
|
||||
export class GBAdminService {
|
||||
|
||||
/**
|
||||
* Services for server administration.
|
||||
*/
|
||||
export class GBAdminService implements IGBAdminService {
|
||||
public static GB_PROMPT: string = 'GeneralBots: ';
|
||||
public static masterBotInstanceId = 0;
|
||||
|
||||
public static StrongRegex = new RegExp('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*+_-])(?=.{8,})');
|
||||
public static StrongRegex = new RegExp(
|
||||
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*+_-])(?=.{8,})'
|
||||
);
|
||||
|
||||
public core: IGBCoreService;
|
||||
|
||||
|
@ -72,266 +59,134 @@ export class GBAdminService implements IGBAdminService {
|
|||
}
|
||||
|
||||
public static generateUuid(): string {
|
||||
return crypto.randomUUID();
|
||||
return msRestAzure.generateUuid();
|
||||
}
|
||||
|
||||
public static async getNodeVersion() {
|
||||
const packageJson = urlJoin(process.cwd(), 'package.json');
|
||||
const pkg = JSON.parse(await fs.readFile(packageJson, 'utf8'));
|
||||
return pkg.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;
|
||||
}
|
||||
|
||||
public static async getADALCredentialsFromUsername(username: string, password: string) {
|
||||
return await msRestAzure.loginWithUsernamePassword(username, password);
|
||||
}
|
||||
|
||||
public static getMobileCode() {
|
||||
return this.getNumberIdentifier(6);
|
||||
}
|
||||
|
||||
public static getRndPassword(): string {
|
||||
let password = caseSensitive_Numbs_SpecialCharacters_PW(15);
|
||||
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 removeRepeatedChars(password, 1);
|
||||
}
|
||||
|
||||
public static getRndReadableIdentifier(): string {
|
||||
return lowercase_PW(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();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://stackoverflow.com/a/52171480
|
||||
*/
|
||||
public static getHash(str: string, 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 static async undeployPackageCommand(text: string, 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);
|
||||
await deployer.undeployPackageFromLocalPath(min.instance, localFolder);
|
||||
}
|
||||
|
||||
public static isSharePointPath(path: string) {
|
||||
return path.indexOf('sharepoint.com') !== -1;
|
||||
}
|
||||
public static async deployPackageCommand(
|
||||
min: GBMinInstance,
|
||||
user: GuaribasUser,
|
||||
text: string,
|
||||
deployer: IGBDeployer
|
||||
public static async getADALTokenFromUsername(
|
||||
username: string,
|
||||
password: string
|
||||
) {
|
||||
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);
|
||||
|
||||
await deployer['deployPackage2'](min, user, localFolder, true);
|
||||
|
||||
}
|
||||
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));
|
||||
const credentials = await GBAdminService.getADALCredentialsFromUsername(
|
||||
username,
|
||||
password
|
||||
);
|
||||
const accessToken = credentials.tokenCache._entries[0].accessToken;
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public static async syncBotServerCommand(min: GBMinInstance, deployer: GBDeployer) {
|
||||
const serverName = `${min.instance.botId}-server`;
|
||||
const service = await AzureDeployerService.createInstance(deployer);
|
||||
service.syncBotServerRepository(min.instance.botId, serverName);
|
||||
public static async getADALCredentialsFromUsername(
|
||||
username: string,
|
||||
password: string
|
||||
) {
|
||||
const credentials = await msRestAzure.loginWithUsernamePassword(
|
||||
username,
|
||||
password
|
||||
);
|
||||
return credentials;
|
||||
}
|
||||
|
||||
public async setValue(instanceId: number, key: string, value: string) {
|
||||
const options = <FindOptions>{ where: {} };
|
||||
options.where = { key: key, instanceId: instanceId };
|
||||
public static getRndPassword() {
|
||||
const passwordGenerator = new PasswordGenerator();
|
||||
const options = {
|
||||
upperCaseAlpha: true,
|
||||
lowerCaseAlpha: true,
|
||||
number: true,
|
||||
specialCharacter: true,
|
||||
minimumLength: 12,
|
||||
maximumLength: 14
|
||||
};
|
||||
let password = passwordGenerator.generatePassword(options);
|
||||
password = password.replace(/[\@\[\=\:\;\?]/g, '#');
|
||||
return password;
|
||||
}
|
||||
|
||||
public static getRndReadableIdentifier() {
|
||||
const passwordGenerator = new PasswordGenerator();
|
||||
const options = {
|
||||
upperCaseAlpha: false,
|
||||
lowerCaseAlpha: true,
|
||||
number: false,
|
||||
specialCharacter: false,
|
||||
minimumLength: 12,
|
||||
maximumLength: 14
|
||||
};
|
||||
const name = passwordGenerator.generatePassword(options);
|
||||
return name;
|
||||
}
|
||||
|
||||
public async setValue(
|
||||
instanceId: number,
|
||||
key: string,
|
||||
value: string
|
||||
): Promise<GuaribasAdmin> {
|
||||
const options = { where: {} };
|
||||
options.where = { key: key };
|
||||
let admin = await GuaribasAdmin.findOne(options);
|
||||
if (admin === null) {
|
||||
if (admin == null) {
|
||||
admin = new GuaribasAdmin();
|
||||
admin.key = key;
|
||||
}
|
||||
admin.value = value;
|
||||
admin.instanceId = instanceId;
|
||||
await admin.save();
|
||||
return admin.save();
|
||||
}
|
||||
|
||||
public async updateSecurityInfo(
|
||||
instanceId: number,
|
||||
authenticatorTenant: string,
|
||||
authenticatorAuthorityHostUrl: string
|
||||
): Promise<IGBInstance> {
|
||||
const options = <FindOptions>{ where: {} };
|
||||
options.where = { instanceId: instanceId };
|
||||
const item = await GuaribasInstance.findOne(options);
|
||||
item.authenticatorTenant = authenticatorTenant;
|
||||
item.authenticatorAuthorityHostUrl = authenticatorAuthorityHostUrl;
|
||||
|
||||
return item.save();
|
||||
}
|
||||
|
||||
public async getValue(instanceId: number, key: string): Promise<string> {
|
||||
const options = <FindOptions>{ where: {} };
|
||||
public async getValue(instanceId: number, key: string) {
|
||||
const options = { where: {} };
|
||||
options.where = { key: key, instanceId: instanceId };
|
||||
const obj = await GuaribasAdmin.findOne(options);
|
||||
return obj.value;
|
||||
return Promise.resolve(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}).`);
|
||||
|
||||
let expiresOnV;
|
||||
try {
|
||||
expiresOnV = await this.getValue(instanceId, `${tokenName}expiresOn`);
|
||||
} catch (error) {
|
||||
throw new Error(`/setupSecurity is required before running /publish.`);
|
||||
}
|
||||
|
||||
public async acquireElevatedToken(instanceId): Promise<string> {
|
||||
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 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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
const refreshToken = await this.getValue(instanceId, 'refreshToken');
|
||||
const resource = 'https://graph.microsoft.com';
|
||||
const authenticationContext = new AuthenticationContext(authorizationUrl);
|
||||
authenticationContext.acquireTokenWithRefreshToken(
|
||||
refreshToken,
|
||||
instance.authenticatorClientId,
|
||||
instance.authenticatorClientSecret,
|
||||
resource,
|
||||
async (err, res) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
const token = res as TokenResponse;
|
||||
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);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async publish(min: GBMinInstance, packageName: string, republish: boolean): Promise<void> {}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,10 @@
|
|||
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}...`,
|
||||
finished_working: 'Done.',
|
||||
unknown_command: text =>
|
||||
`Well, but ${text} is not a administrative General Bots command, I will try to search for it.`,
|
||||
hi: text => `Hello, ${text}.`,
|
||||
undeployPackage: text => `Undeploying package ${text}...`,
|
||||
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}).`,
|
||||
wrong_password: 'Sorry, wrong password. Please, try again.',
|
||||
enter_authenticator_tenant: 'Enter the Authenticator Tenant (eg.: domain.onmicrosoft.com):',
|
||||
enter_authenticator_authority_host_url: 'Enter the Authority Host URL (eg.: https://login.microsoftonline.com): ',
|
||||
enter_authenticator_client_id: `Enter the Client Id GUID: Get from
|
||||
[this url](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview)`,
|
||||
enter_authenticator_client_secret: 'Enter the Client Secret:',
|
||||
publish_must_be_admin: 'Seu telefone precisa estar com privilégios administrativos para realizar publicação.',
|
||||
publish_success: 'Publicação realizada.',
|
||||
publish_type_yes: 'Por favor, digite *Sim* para continuar com a publicação.',
|
||||
publish_canceled: 'Publicação cancelada.'
|
||||
},
|
||||
'pt-BR': {
|
||||
authenticate: 'Please, authenticate:',
|
||||
welcome: 'Welcome to pragmatismo.com.br GeneralBots Administration.',
|
||||
which_task: 'Which task do you wanna run now?',
|
||||
working: command => `I'm working on ${command}...`,
|
||||
finished_working: 'Done.',
|
||||
working: (command) => `I'm working on ${command}...`,
|
||||
finshed_working: 'Done.',
|
||||
unknown_command: text =>
|
||||
`Well, but ${text} is not a administrative General Bots command, I will try to search for it.`,
|
||||
hi: text => `Hello, ${text}.`,
|
||||
|
@ -37,16 +12,11 @@ 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}).`,
|
||||
wrong_password: 'Sorry, wrong password. Please, try again.',
|
||||
enter_authenticator_tenant: 'Enter the Authenticator Tenant (eg.: domain.onmicrosoft.com):',
|
||||
enter_authenticator_authority_host_url: 'Enter the Authority Host URL (eg.: https://login.microsoftonline.com): ',
|
||||
enter_authenticator_client_id: `Enter the Client Id GUID: Get from
|
||||
[this url](https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview)`,
|
||||
enter_authenticator_client_secret: 'Enter the Client Secret:',
|
||||
publish_must_be_admin: 'Seu telefone precisa estar com privilégios administrativos para realizar publicação.',
|
||||
publish_success: 'Publicação realizada.',
|
||||
publish_type_yes: 'Por favor, digite *Sim* para continuar com a publicação.',
|
||||
publish_canceled: 'Publicação cancelada.'
|
||||
consent: (url) => `Please, consent access to this app at: [Microsoft Online](${url}).`,
|
||||
wrong_password: 'Sorry, wrong password. Please, try again.'
|
||||
},
|
||||
'pt-BR': {
|
||||
show_video: 'Vou te mostrar um vídeo. Por favor, aguarde...',
|
||||
hi: msg => `Oi, ${msg}.`
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,35 +36,18 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
import { GuaribasConversation, GuaribasConversationMessage } from './models/index.js';
|
||||
const UrlJoin = require('url-join');
|
||||
|
||||
import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
|
||||
/**
|
||||
* .gblib Package handler.
|
||||
*/
|
||||
export class GBAnalyticsPackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[];
|
||||
public async getDialogs (min: GBMinInstance) {
|
||||
GBLog.verbose(`getDialogs called.`);
|
||||
}
|
||||
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> {
|
||||
GBLog.verbose(`unloadPackage called.`);
|
||||
}
|
||||
public async loadBot (min: GBMinInstance): Promise<void> {
|
||||
GBLog.verbose(`loadBot called.`);
|
||||
}
|
||||
public async unloadBot (min: GBMinInstance): Promise<void> {
|
||||
GBLog.verbose(`unloadBot called.`);
|
||||
}
|
||||
public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
|
||||
GBLog.verbose(`onNewSession called.`);
|
||||
}
|
||||
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
|
||||
GBLog.verbose(`onExchangeData called.`);
|
||||
}
|
||||
public sysPackages: IGBPackage[] = null;
|
||||
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {}
|
||||
public unloadPackage(core: IGBCoreService): void {}
|
||||
public loadBot(min: GBMinInstance): void {}
|
||||
public unloadBot(min: GBMinInstance): void {}
|
||||
public onNewSession(min: GBMinInstance, step: any): void {}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,6 +36,13 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import {
|
||||
DataTypeDate,
|
||||
DataTypeDecimal,
|
||||
DataTypes,
|
||||
DataTypeUUIDv4
|
||||
} from 'sequelize';
|
||||
|
||||
import {
|
||||
AutoIncrement,
|
||||
BelongsTo,
|
||||
|
@ -52,105 +61,90 @@ 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.gblib/models';
|
||||
|
||||
/**
|
||||
* A conversation that groups many messages.
|
||||
*/
|
||||
@Table
|
||||
export class GuaribasConversation extends Model<GuaribasConversation> {
|
||||
|
||||
@PrimaryKey
|
||||
@AutoIncrement
|
||||
@Column(DataType.INTEGER)
|
||||
declare conversationId: number;
|
||||
|
||||
@ForeignKey(() => GuaribasInstance)
|
||||
@Column(DataType.INTEGER)
|
||||
declare instanceId: number;
|
||||
@Column
|
||||
public conversationId: 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(DataType.STRING(512))
|
||||
declare feedback: string;
|
||||
@Column
|
||||
public rate: number;
|
||||
|
||||
@Column
|
||||
@CreatedAt
|
||||
@Column(DataType.DATE)
|
||||
declare createdAt: Date;
|
||||
public createdAt: Date;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@UpdatedAt
|
||||
declare updatedAt: Date;
|
||||
@Column public text: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare text: string;
|
||||
@HasMany(() => GuaribasConversationMessage)
|
||||
public conversationMessage: GuaribasConversationMessage[];
|
||||
|
||||
@ForeignKey(() => GuaribasUser)
|
||||
@Column(DataType.INTEGER)
|
||||
declare startedByUserId: number;
|
||||
@Column
|
||||
public startedByUserId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasUser)
|
||||
declare startedBy: GuaribasUser;
|
||||
public startedBy: GuaribasUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single message in a conversation.
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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. |
|
||||
|
@ -32,66 +34,38 @@
|
|||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
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 { GuaribasUser } from '../../security.gblib/models';
|
||||
import { GuaribasConversation, GuaribasConversationMessage } from '../models';
|
||||
|
||||
/**
|
||||
* Base services for Bot Analytics.
|
||||
*/
|
||||
export class AnalyticsService {
|
||||
public async createConversation (user: GuaribasUser): Promise<GuaribasConversation> {
|
||||
const conversation = new GuaribasConversation();
|
||||
conversation.startedBy = user;
|
||||
conversation.startedByUserId = user.userId;
|
||||
conversation.instanceId = user.instanceId;
|
||||
|
||||
return await conversation.save();
|
||||
public async createConversation(
|
||||
user: GuaribasUser
|
||||
): Promise<GuaribasConversation> {
|
||||
return new Promise<GuaribasConversation>(
|
||||
(resolve, reject) => {
|
||||
const conversation = new GuaribasConversation();
|
||||
conversation.startedBy = user;
|
||||
conversation.startedByUserId = user.userId;
|
||||
conversation.save().then((value: GuaribasConversation) => {
|
||||
resolve(value);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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,
|
||||
locale,
|
||||
feedback
|
||||
);
|
||||
|
||||
const options = <FindOptions>{ where: {} };
|
||||
options.where = { conversationId: conversationId, instanceId: instanceId };
|
||||
const item = await GuaribasConversation.findOne(options);
|
||||
|
||||
item.feedback = feedback;
|
||||
item.rate = rate;
|
||||
item.rateDate = new Date();
|
||||
await item.save();
|
||||
|
||||
return rate;
|
||||
}
|
||||
|
||||
public async createMessage (
|
||||
instanceId: number,
|
||||
conversationId: number,
|
||||
userId: number,
|
||||
public createMessage(
|
||||
conversation: GuaribasConversation,
|
||||
user: GuaribasUser,
|
||||
content: string
|
||||
): Promise<GuaribasConversationMessage> {
|
||||
|
||||
const message = GuaribasConversationMessage.build();
|
||||
message.content = typeof content === 'object' ? JSON.stringify(content) : content;
|
||||
message.instanceId = instanceId;
|
||||
message.userId = userId;
|
||||
message.conversationId = conversationId;
|
||||
|
||||
return await message.save();
|
||||
return new Promise<GuaribasConversationMessage>(
|
||||
(resolve, reject) => {
|
||||
const message = GuaribasConversationMessage.build();
|
||||
message.conversation = conversation;
|
||||
message.user = user;
|
||||
message.content = content;
|
||||
message.save().then((value: GuaribasConversationMessage) => {
|
||||
resolve(value);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
69
packages/azuredeployer.gbapp/dialogs/BotFarmDialog.ts
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*****************************************************************************\
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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 { BotAdapter } from 'botbuilder';
|
||||
import { GBMinInstance } from 'botlib';
|
||||
import { IGBDialog } from 'botlib';
|
||||
import { Messages } from '../strings';
|
||||
|
||||
export class BotFarmDialog extends IGBDialog {
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
*
|
||||
* @param bot The bot adapter.
|
||||
* @param min The minimal bot instance data.
|
||||
*/
|
||||
public static setup(bot: BotAdapter, min: GBMinInstance) {
|
||||
min.dialogs.add('/createBotFarm', [
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
await step.prompt('choicePrompt', Messages[locale].what_about_me, [
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5'
|
||||
]);
|
||||
},
|
||||
async step => {
|
||||
const locale = step.context.activity.locale;
|
||||
await step.context.sendActivity(Messages[locale].thanks);
|
||||
}
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,215 +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. |
|
||||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'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';
|
||||
|
||||
/**
|
||||
* Handles command-line dialog for getting info for Boot Bot.
|
||||
*/
|
||||
export class StartDialog {
|
||||
public static async createBaseInstance (deployer, freeTier) {
|
||||
// No .env so asks for cloud credentials to start a new farm.
|
||||
|
||||
if (!await GBUtil.exists(`.env`)) {
|
||||
process.stdout.write(
|
||||
'A empty enviroment is detected. To start automatic deploy, please enter some information:\n'
|
||||
);
|
||||
}
|
||||
|
||||
let botId: string;
|
||||
while (botId === undefined) {
|
||||
botId = this.retrieveBotId();
|
||||
}
|
||||
|
||||
let username: string;
|
||||
while (username === undefined) {
|
||||
username = this.retrieveUsername();
|
||||
}
|
||||
|
||||
let password: string;
|
||||
while (password === undefined) {
|
||||
password = this.retrievePassword();
|
||||
}
|
||||
|
||||
// Connects to the cloud and retrieves subscriptions.
|
||||
|
||||
const credentials = await GBAdminService.getADALCredentialsFromUsername(username, password);
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
let appId: string;
|
||||
while (appId === undefined) {
|
||||
appId = this.retrieveAppId();
|
||||
}
|
||||
|
||||
let appPassword: string;
|
||||
while (appPassword === undefined) {
|
||||
appPassword = this.retrieveAppPassword();
|
||||
}
|
||||
|
||||
// Prepares the first instance on bot farm.
|
||||
|
||||
const instance = <IGBInstance>{};
|
||||
|
||||
instance.botId = botId;
|
||||
instance.state = 'active';
|
||||
instance.cloudUsername = username;
|
||||
instance.cloudPassword = password;
|
||||
instance.cloudSubscriptionId = subscriptionId;
|
||||
instance.cloudLocation = location;
|
||||
instance.marketplaceId = appId;
|
||||
instance.marketplacePassword = appPassword;
|
||||
instance.adminPass = await GBUtil.hashPassword(GBAdminService.getRndPassword());
|
||||
|
||||
return { instance, credentials, subscriptionId , installationDeployer};
|
||||
}
|
||||
|
||||
private static retrieveUsername () {
|
||||
let value = GBConfigService.get('CLOUD_USERNAME');
|
||||
if (value === undefined) {
|
||||
process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_USERNAME:`);
|
||||
value = scanf('%s').replace(/(\n|\r)+$/, '');
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static retrievePassword () {
|
||||
let password = GBConfigService.get('CLOUD_PASSWORD');
|
||||
if (password === undefined) {
|
||||
process.stdout.write(`${GBAdminService.GB_PROMPT}CLOUD_PASSWORD:`);
|
||||
password = scanf('%s').replace(/(\n|\r)+$/, '');
|
||||
}
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
private static retrieveBotId () {
|
||||
let botId = GBConfigService.get('BOT_ID');
|
||||
if (botId === undefined) {
|
||||
process.stdout.write(
|
||||
`${GBAdminService.GB_PROMPT}Choose a unique bot Id containing lowercase letters, digits or
|
||||
dashes (cannot use dash as the first two or last one characters),
|
||||
cannot start or end with or contain consecutive dashes and having 4 to 42 characters long.\n`
|
||||
);
|
||||
process.stdout.write(`${GBAdminService.GB_PROMPT}BOT_ID:`);
|
||||
botId = scanf('%s').replace(/(\n|\r)+$/, '');
|
||||
}
|
||||
|
||||
return botId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Update Manifest in Azure: "signInAudience": "AzureADandPersonalMicrosoftAccount" and "accessTokenAcceptedVersion": 2.
|
||||
*/
|
||||
private static retrieveAppId () {
|
||||
let appId = GBConfigService.get('MARKETPLACE_ID');
|
||||
if (appId === undefined) {
|
||||
process.stdout.write(
|
||||
`Sorry, this part cannot be automated yet due to Microsoft schedule,
|
||||
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)+$/, '');
|
||||
}
|
||||
|
||||
return appId;
|
||||
}
|
||||
|
||||
private static retrieveAppPassword () {
|
||||
let appPassword = GBConfigService.get('MARKETPLACE_SECRET');
|
||||
if (appPassword === undefined) {
|
||||
process.stdout.write('Generated Password (MARKETPLACE_SECRET):');
|
||||
appPassword = scanf('%s').replace(/(\n|\r)+$/, '');
|
||||
}
|
||||
|
||||
return appPassword;
|
||||
}
|
||||
|
||||
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})`);
|
||||
map[index++] = element;
|
||||
});
|
||||
let subscriptionIndex;
|
||||
if (!subscriptionIndex && subscriptionId === undefined) {
|
||||
process.stdout.write('CLOUD_SUBSCRIPTIONID (type a number):');
|
||||
subscriptionIndex = scanf('%d');
|
||||
subscriptionId = map[subscriptionIndex].subscriptionId;
|
||||
}
|
||||
|
||||
return subscriptionId;
|
||||
}
|
||||
|
||||
private static retrieveLocation () {
|
||||
let location = GBConfigService.get('CLOUD_LOCATION');
|
||||
if (location === undefined) {
|
||||
process.stdout.write('CLOUD_LOCATION (eg. westus):');
|
||||
location = scanf('%s');
|
||||
}
|
||||
|
||||
return location;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,33 +36,19 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
const UrlJoin = require('url-join');
|
||||
import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
|
||||
/**
|
||||
* Package for Azure Deployer.
|
||||
*/
|
||||
export class GBAzureDeployerPackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[];
|
||||
public async getDialogs (min: GBMinInstance) {
|
||||
GBLog.verbose(`getDialogs called.`);
|
||||
}
|
||||
public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
|
||||
GBLog.verbose(`loadPackage called.`);
|
||||
}
|
||||
public async unloadPackage (core: IGBCoreService): Promise<void> {
|
||||
GBLog.verbose(`unloadPackage called.`);
|
||||
}
|
||||
public async loadBot (min: GBMinInstance): Promise<void> {
|
||||
GBLog.verbose(`loadBot called.`);
|
||||
}
|
||||
public async unloadBot (min: GBMinInstance): Promise<void> {
|
||||
GBLog.verbose(`unloadBot called.`);
|
||||
}
|
||||
public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
|
||||
GBLog.verbose(`onNewSession called.`);
|
||||
}
|
||||
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
|
||||
GBLog.verbose(`onExchangeData called.`);
|
||||
}
|
||||
export class GBWhatsappPackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[] = null;
|
||||
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {}
|
||||
|
||||
public unloadPackage(core: IGBCoreService): void {}
|
||||
|
||||
public loadBot(min: GBMinInstance): void {}
|
||||
|
||||
public unloadBot(min: GBMinInstance): void {}
|
||||
public onNewSession(min: GBMinInstance, step: any): void {}
|
||||
}
|
||||
|
|
|
@ -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...'
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
*This is a General Bots open core package, more information can be found on the [BotServer](https://github.com/pragmatismo-io/BotServer) repository.*
|
||||
|
||||
This alpha version is using a hack in form of converter to
|
||||
translate BASIC to TS and string replacements to emulate await code.
|
||||
See http://jsfiddle.net/roderick/dym05hsy for more info on vb2ts, so
|
||||
http://stevehanov.ca/blog/index.php?id=92 should be used to run it without
|
||||
translation and enhance classic BASIC experience.
|
|
@ -1,124 +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. |
|
||||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
import { GuaribasSchedule } from '../core.gbapp/models/GBModel.js';
|
||||
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 async loadPackage(core: IGBCoreService, sequelize: Sequelize): Promise<void> {
|
||||
core.sequelize.addModels([GuaribasSchedule]);
|
||||
}
|
||||
|
||||
public async getDialogs(min: GBMinInstance) {
|
||||
GBLog.verbose(`getDialogs called.`);
|
||||
}
|
||||
public async unloadPackage(core: IGBCoreService): Promise<void> {
|
||||
GBLog.verbose(`unloadPackage called.`);
|
||||
}
|
||||
public async unloadBot(min: GBMinInstance): Promise<void> {
|
||||
GBLog.verbose(`unloadBot called.`);
|
||||
}
|
||||
public async onNewSession(min: GBMinInstance, step: GBDialogStep): Promise<void> {
|
||||
GBLog.verbose(`onNewSession called.`);
|
||||
}
|
||||
public async onExchangeData(min: GBMinInstance, kind: string, data: any) {
|
||||
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 = {};
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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' };
|
||||
}
|
||||
|
||||
}
|
|
@ -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 };
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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}...`);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
||||
};
|
||||
};
|
|
@ -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`);
|
|
@ -1,10 +0,0 @@
|
|||
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:'
|
||||
}
|
||||
};
|
|
@ -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");
|
||||
});
|
|
@ -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"
|
||||
}});
|
||||
|
||||
});
|
|
@ -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'
|
||||
}
|
||||
});
|
||||
});
|
|
@ -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"
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"enabledAdmin": "true",
|
||||
"searchScore": ".45",
|
||||
"nlpScore": ".80",
|
||||
"state":"active",
|
||||
"autoPackageSync": "gbdialog, gbot, gbtheme"
|
||||
"searchScore": ".15",
|
||||
"nlpScore": ".15",
|
||||
"nlpVsSearch": ".4"
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,18 +36,30 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import {
|
||||
AutoIncrement,
|
||||
BelongsTo,
|
||||
Column,
|
||||
CreatedAt,
|
||||
DataType,
|
||||
ForeignKey,
|
||||
Model,
|
||||
PrimaryKey,
|
||||
Table,
|
||||
UpdatedAt
|
||||
} from 'sequelize-typescript';
|
||||
const UrlJoin = require('url-join');
|
||||
|
||||
import { GuaribasInstance } from '../../core.gbapp/models/GBModel.js';
|
||||
import { GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
|
||||
import { Sequelize } from 'sequelize-typescript';
|
||||
import { ConsoleDirectLine } from './services/ConsoleDirectLine';
|
||||
|
||||
export class GBConsolePackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[] = null;
|
||||
public channel: ConsoleDirectLine;
|
||||
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
|
||||
}
|
||||
|
||||
public unloadPackage(core: IGBCoreService): void {
|
||||
}
|
||||
|
||||
public loadBot(min: GBMinInstance): void {
|
||||
this.channel = new ConsoleDirectLine(min.instance.webchatKey);
|
||||
}
|
||||
|
||||
public unloadBot(min: GBMinInstance): void {
|
||||
}
|
||||
|
||||
public onNewSession(min: GBMinInstance, step: any): void {
|
||||
}
|
||||
}
|
193
packages/console.gblib/services/ConsoleDirectLine.ts
Normal file
|
@ -0,0 +1,193 @@
|
|||
/*****************************************************************************\
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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. |
|
||||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
const Path = require('path');
|
||||
const Fs = require('fs');
|
||||
const _ = require('lodash');
|
||||
const Parse = require('csv-parse');
|
||||
const Async = require('async');
|
||||
const UrlJoin = require('url-join');
|
||||
const Walk = require('fs-walk');
|
||||
const logger = require('../../../src/logger');
|
||||
const Swagger = require('swagger-client');
|
||||
const rp = require('request-promise');
|
||||
import { GBService } from 'botlib';
|
||||
|
||||
export class ConsoleDirectLine extends GBService {
|
||||
|
||||
public pollInterval = 1000;
|
||||
public directLineSecret = '';
|
||||
public directLineClientName = 'DirectLineClient';
|
||||
public directLineSpecUrl = 'https://docs.botframework.com/en-us/restapi/directline3/swagger.json';
|
||||
|
||||
constructor(directLineSecret) {
|
||||
super();
|
||||
|
||||
this.directLineSecret = directLineSecret;
|
||||
|
||||
// TODO: Migrate to Swagger 3.
|
||||
const directLineClient = rp(this.directLineSpecUrl)
|
||||
.then(function (spec) {
|
||||
return new Swagger({
|
||||
spec: JSON.parse(spec.trim()),
|
||||
usePromise: true
|
||||
});
|
||||
})
|
||||
.then(function (client) {
|
||||
client.clientAuthorizations.add('AuthorizationBotConnector',
|
||||
new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' + directLineSecret, 'header'));
|
||||
return client;
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Error initializing DirectLine client', err);
|
||||
});
|
||||
|
||||
// TODO: Remove *this* issue.
|
||||
const _this_ = this;
|
||||
directLineClient.then((client) => {
|
||||
client.Conversations.Conversations_StartConversation()
|
||||
.then(function (response) {
|
||||
return response.obj.conversationId;
|
||||
})
|
||||
.then(function (conversationId) {
|
||||
_this_.sendMessagesFromConsole(client, conversationId);
|
||||
_this_.pollMessages(client, conversationId);
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.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', function (e) {
|
||||
const input = e.toString().trim();
|
||||
if (input) {
|
||||
// exit
|
||||
if (input.toLowerCase() === 'exit') {
|
||||
return process.exit();
|
||||
}
|
||||
|
||||
client.Conversations.Conversations_PostActivity(
|
||||
{
|
||||
conversationId: conversationId,
|
||||
activity: {
|
||||
textFormat: 'plain',
|
||||
text: input,
|
||||
type: 'message',
|
||||
from: {
|
||||
id: _this_.directLineClientName,
|
||||
name: _this_.directLineClientName
|
||||
}
|
||||
}
|
||||
}).catch(function (err) {
|
||||
console.error('Error sending message:', err);
|
||||
});
|
||||
|
||||
process.stdout.write('Command> ');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** TBD: Poll Messages from conversation using DirectLine client */
|
||||
public pollMessages(client, conversationId) {
|
||||
const _this_ = this;
|
||||
console.log('Starting polling message for conversationId: ' + conversationId);
|
||||
let watermark = null;
|
||||
setInterval(function () {
|
||||
client.Conversations.Conversations_GetActivities({ conversationId: conversationId, watermark: watermark })
|
||||
.then(function (response) {
|
||||
watermark = response.obj.watermark; // use watermark so subsequent requests skip old messages
|
||||
return response.obj.activities;
|
||||
})
|
||||
.then(_this_.printMessages, _this_.directLineClientName);
|
||||
}, this.pollInterval);
|
||||
}
|
||||
|
||||
public printMessages(activities, directLineClientName) {
|
||||
|
||||
if (activities && activities.length) {
|
||||
// ignore own messages
|
||||
activities = activities.filter(function (m) { return m.from.id !== directLineClientName; });
|
||||
|
||||
if (activities.length) {
|
||||
|
||||
// print other messages
|
||||
activities.forEach(activity => {
|
||||
console.log(activity.text);
|
||||
}, this);
|
||||
|
||||
process.stdout.write('Command> ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public printMessage(activity) {
|
||||
if (activity.text) {
|
||||
console.log(activity.text);
|
||||
}
|
||||
|
||||
if (activity.attachments) {
|
||||
activity.attachments.forEach(function (attachment) {
|
||||
switch (attachment.contentType) {
|
||||
case 'application/vnd.microsoft.card.hero':
|
||||
this.renderHeroCard(attachment);
|
||||
break;
|
||||
|
||||
case 'image/png':
|
||||
console.log('Opening the requested image ' + attachment.contentUrl);
|
||||
open(attachment.contentUrl);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public renderHeroCard(attachment) {
|
||||
const width = 70;
|
||||
const contentLine = function (content) {
|
||||
return ' '.repeat((width - content.length) / 2) +
|
||||
content +
|
||||
' '.repeat((width - content.length) / 2);
|
||||
};
|
||||
|
||||
console.log('/' + '*'.repeat(width + 1));
|
||||
console.log('*' + contentLine(attachment.content.title) + '*');
|
||||
console.log('*' + ' '.repeat(width) + '*');
|
||||
console.log('*' + contentLine(attachment.content.text) + '*');
|
||||
console.log('*'.repeat(width + 1) + '/');
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
*This is a General Bots BASIC ackage, more information can be found on the [BotServer](https://github.com/GeneralBots/BotServer) repository.*
|
||||
*This is a General Bots open core package, more information can be found on the [BotServer](https://github.com/pragmatismo-io/BotServer) repository.*
|
||||
|
|
|
@ -1,77 +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. |
|
||||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
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';
|
||||
/**
|
||||
* Dialog for the bot explains about itself.
|
||||
*/
|
||||
export class BroadcastDialog extends IGBDialog {
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
*
|
||||
* @param bot The bot adapter.
|
||||
* @param min The minimal bot instance data.
|
||||
*/
|
||||
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);
|
||||
return await step.next();
|
||||
}
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,113 +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. |
|
||||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
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 { CollectionUtil } from 'pragmatismo-io-framework';
|
||||
/**
|
||||
* Dialog for the bot explains about itself.
|
||||
*/
|
||||
export class LanguageDialog extends IGBDialog {
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
},
|
||||
|
||||
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 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 });
|
||||
}
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,83 +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. |
|
||||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
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';
|
||||
/**
|
||||
* Dialog for the bot explains about itself.
|
||||
*/
|
||||
export class SwitchBotDialog extends IGBDialog {
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
*
|
||||
* @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);
|
||||
}
|
||||
},
|
||||
|
||||
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 step.next();
|
||||
}
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,16 +37,11 @@
|
|||
'use strict';
|
||||
|
||||
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 {WaterfallDialog } from 'botbuilder-dialogs';
|
||||
import { IGBDialog } from 'botlib';
|
||||
import { GBMinInstance } from 'botlib';
|
||||
import { Messages } from '../strings';
|
||||
|
||||
/**
|
||||
* Dialog for Welcoming people.
|
||||
*/
|
||||
export class WelcomeDialog extends IGBDialog {
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
|
@ -52,58 +49,40 @@ 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
|
||||
const user = await min.userProfile.get(context, {});
|
||||
const locale = step.context.activity.locale;
|
||||
|
||||
if (!user.once) {
|
||||
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 step.context.sendActivity(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 &&
|
||||
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();
|
||||
}
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,10 @@
|
|||
|
||||
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';
|
||||
/**
|
||||
* Dialog for the bot explains about itself.
|
||||
*/
|
||||
import { IGBDialog } from 'botlib';
|
||||
import { GBMinInstance } from 'botlib';
|
||||
import { Messages } from '../strings';
|
||||
|
||||
export class WhoAmIDialog extends IGBDialog {
|
||||
/**
|
||||
* Setup dialogs flows and define services call.
|
||||
|
@ -49,34 +49,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 step.context.sendActivity(`${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) {
|
||||
await step.context.sendActivity(Messages[locale].show_video);
|
||||
await min.conversationalService.sendEvent(step, 'play', {
|
||||
playerType: 'video',
|
||||
data: min.instance.whoAmIVideo.trim()
|
||||
});
|
||||
}
|
||||
])
|
||||
);
|
||||
|
||||
await step.replaceDialog('/ask', { isReturning: true });
|
||||
|
||||
return await step.next();
|
||||
}
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,47 +36,42 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||
const UrlJoin = require('url-join');
|
||||
|
||||
import { GBMinInstance, IGBPackage } from 'botlib';
|
||||
|
||||
import { IGBCoreService} 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 { WelcomeDialog } from './dialogs/WelcomeDialog';
|
||||
import { WhoAmIDialog } from './dialogs/WhoAmIDialog';
|
||||
import { GuaribasChannel, GuaribasException, GuaribasInstance, GuaribasPackage } from './models/GBModel';
|
||||
|
||||
/**
|
||||
* Package for core.gbapp.
|
||||
*/
|
||||
export class GBCorePackage implements IGBPackage {
|
||||
public sysPackages: IGBPackage[];
|
||||
public CurrentEngineName = 'guaribas-1.0.0';
|
||||
public static CurrentEngineName = 'guaribas-1.0.0';
|
||||
public sysPackages: IGBPackage[] = null;
|
||||
|
||||
public async loadPackage (core: IGBCoreService, sequelize: Sequelize): Promise<void> {
|
||||
core.sequelize.addModels([GuaribasInstance, GuaribasPackage, GuaribasChannel, GuaribasLog, GuaribasApplications]);
|
||||
public loadPackage(core: IGBCoreService, sequelize: Sequelize): void {
|
||||
core.sequelize.addModels([
|
||||
GuaribasInstance,
|
||||
GuaribasPackage,
|
||||
GuaribasChannel,
|
||||
GuaribasException
|
||||
]);
|
||||
}
|
||||
|
||||
public async getDialogs (min: GBMinInstance) {
|
||||
GBLog.verbose(`getDialogs called.`);
|
||||
}
|
||||
public async unloadPackage (core: IGBCoreService): Promise<void> {
|
||||
GBLog.verbose(`unloadPackage called.`);
|
||||
}
|
||||
public async unloadBot (min: GBMinInstance): Promise<void> {
|
||||
GBLog.verbose(`unloadBot called.`);
|
||||
}
|
||||
public async onNewSession (min: GBMinInstance, step: GBDialogStep): Promise<void> {
|
||||
GBLog.verbose(`onNewSession called.`);
|
||||
}
|
||||
public async onExchangeData (min: GBMinInstance, kind: string, data: any) {
|
||||
GBLog.verbose(`onExchangeData called.`);
|
||||
public unloadPackage(core: IGBCoreService): void {
|
||||
|
||||
}
|
||||
|
||||
public async loadBot (min: GBMinInstance): Promise<void> {
|
||||
public loadBot(min: GBMinInstance): void {
|
||||
WelcomeDialog.setup(min.bot, min);
|
||||
WhoAmIDialog.setup(min.bot, min);
|
||||
SwitchBotDialog.setup(min.bot, min);
|
||||
BroadcastDialog.setup(min.bot, min);
|
||||
LanguageDialog.setup(min.bot, min);
|
||||
}
|
||||
|
||||
public unloadBot(min: GBMinInstance): void {
|
||||
|
||||
}
|
||||
public onNewSession(min: GBMinInstance, step: any): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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. |
|
||||
|
@ -49,352 +51,260 @@ import {
|
|||
|
||||
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;
|
||||
@Column
|
||||
public description: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare description: string;
|
||||
@Column
|
||||
public version: string;
|
||||
|
||||
@Column({ type: DataType.STRING(16) })
|
||||
declare state: string;
|
||||
@Column
|
||||
public enabledAdmin: boolean;
|
||||
|
||||
declare version: string;
|
||||
/* Services section on bot.json */
|
||||
|
||||
@Column(DataType.STRING(64))
|
||||
declare botKey: string;
|
||||
@Column
|
||||
public engineName: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare enabledAdmin: boolean;
|
||||
@Column
|
||||
public marketplaceId: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare engineName: string;
|
||||
@Column
|
||||
public textAnalyticsKey: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare marketplaceId: string;
|
||||
@Column
|
||||
public textAnalyticsEndpoint: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare textAnalyticsKey: string;
|
||||
@Column
|
||||
public marketplacePassword: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare textAnalyticsEndpoint: string;
|
||||
@Column
|
||||
public webchatKey: string;
|
||||
|
||||
@Column({ type: DataType.STRING(64) })
|
||||
declare translatorKey: string;
|
||||
@Column
|
||||
public authenticatorTenant: string;
|
||||
|
||||
@Column({ type: DataType.STRING(128) })
|
||||
declare translatorEndpoint: string;
|
||||
@Column
|
||||
public authenticatorAuthorityHostUrl: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare marketplacePassword: string;
|
||||
@Column
|
||||
public authenticatorClientId: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare webchatKey: string;
|
||||
@Column
|
||||
public authenticatorClientSecret: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare authenticatorTenant: string;
|
||||
@Column
|
||||
public cloudSubscriptionId: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare authenticatorAuthorityHostUrl: string;
|
||||
@Column
|
||||
public cloudUsername: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare cloudSubscriptionId: string;
|
||||
@Column
|
||||
public cloudPassword: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare cloudUsername: string;
|
||||
@Column
|
||||
public cloudLocation: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare cloudPassword: string;
|
||||
@Column
|
||||
public whatsappBotKey: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare cloudLocation: string;
|
||||
@Column
|
||||
public whatsappServiceKey: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare googleBotKey: string;
|
||||
@Column
|
||||
public whatsappServiceNumber: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare googleChatApiKey: string;
|
||||
@Column
|
||||
public whatsappServiceUrl: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare googleChatSubscriptionName: string;
|
||||
@Column
|
||||
public whatsappServiceWebhookUrl: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare googleClientEmail: string;
|
||||
@Column
|
||||
public smsKey: string;
|
||||
|
||||
@Column({ type: DataType.STRING(4000) })
|
||||
declare googlePrivateKey: string;
|
||||
@Column
|
||||
public smsSecret: string;
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
declare googleProjectId: string;
|
||||
@Column
|
||||
public smsServiceNumber: string;
|
||||
|
||||
@Column({ type: DataType.STRING(255) })
|
||||
declare facebookWorkplaceVerifyToken: string;
|
||||
@Column
|
||||
public speechKey: string;
|
||||
|
||||
@Column({ type: DataType.STRING(255) })
|
||||
declare facebookWorkplaceAppSecret: string;
|
||||
@Column
|
||||
public speechKeyEndpoint: 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
|
||||
public adminPass: 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;
|
||||
/* Settings section of bot.json */
|
||||
|
||||
@Column(DataType.FLOAT)
|
||||
declare searchScore: number;
|
||||
public nlpVsSearch: number;
|
||||
|
||||
@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;
|
||||
|
||||
@Column(DataType.STRING(4000))
|
||||
declare params: string;
|
||||
public updatedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Each packaged listed for use in a bot instance.
|
||||
*/
|
||||
@Table
|
||||
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;
|
||||
|
||||
@Column({ type: DataType.STRING(512) })
|
||||
declare custom: string;
|
||||
public updatedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* A bot channel.
|
||||
*/
|
||||
@Table
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* An exception that has been thrown.
|
||||
*/
|
||||
@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(DataType.STRING(1))
|
||||
declare kind: string;
|
||||
|
||||
@ForeignKey(() => GuaribasInstance)
|
||||
@Column(DataType.INTEGER)
|
||||
declare instanceId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasInstance)
|
||||
declare instance: GuaribasInstance;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@CreatedAt
|
||||
declare createdAt: Date;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@UpdatedAt
|
||||
declare 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 message: 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;
|
||||
}
|
||||
|
||||
@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;
|
||||
|
||||
@ForeignKey(() => GuaribasInstance)
|
||||
@Column(DataType.INTEGER)
|
||||
declare instanceId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasInstance)
|
||||
declare instance: GuaribasInstance;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@CreatedAt
|
||||
declare createdAt: Date;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@UpdatedAt
|
||||
declare updatedAt: Date;
|
||||
public updatedAt: Date;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
/*****************************************************************************\
|
||||
| █████ █████ ██ █ █████ █████ ████ ██ ████ █████ █████ ███ ® |
|
||||
| ██ █ ███ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| ██ ███ ████ █ ██ █ ████ █████ ██████ ██ ████ █ █ █ ██ |
|
||||
| ██ ██ █ █ ██ █ █ ██ ██ ██ ██ ██ ██ █ ██ ██ █ █ |
|
||||
| █████ █████ █ ███ █████ ██ ██ ██ ██ █████ ████ █████ █ ███ |
|
||||
| ( )_ _ |
|
||||
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
|
||||
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
|
||||
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
|
||||
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
|
||||
| | | ( )_) | |
|
||||
| (_) \___/' |
|
||||
| |
|
||||
| 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,55 +23,53 @@
|
|||
| 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. |
|
||||
| |
|
||||
\*****************************************************************************/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { TurnContext } from 'botbuilder';
|
||||
import { WaterfallStepContext } from 'botbuilder-dialogs';
|
||||
import { GBMinInstance } from 'botlib';
|
||||
const WaitUntil = require('wait-until');
|
||||
|
||||
/**
|
||||
* @fileoverview General Bots server core.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
export class DialogClass {
|
||||
public min: GBMinInstance;
|
||||
public context: TurnContext;
|
||||
public step: WaterfallStepContext;
|
||||
|
||||
import {
|
||||
AutoIncrement,
|
||||
BelongsTo,
|
||||
Column,
|
||||
CreatedAt,
|
||||
DataType,
|
||||
ForeignKey,
|
||||
Model,
|
||||
PrimaryKey,
|
||||
Table,
|
||||
UpdatedAt
|
||||
} from 'sequelize-typescript';
|
||||
constructor(min: GBMinInstance) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
import { GuaribasInstance } from '../../core.gbapp/models/GBModel.js';
|
||||
public async hear(cb) {
|
||||
let idCallback = Math.floor(Math.random() * 1000000000000);
|
||||
this.min.cbMap[idCallback] = cb;
|
||||
await this.step.beginDialog('/hear', { id: idCallback});
|
||||
}
|
||||
|
||||
@Table
|
||||
//tslint:disable-next-line:max-classes-per-file
|
||||
export class GuaribasSchedule extends Model<GuaribasSchedule> {
|
||||
@Column(DataType.STRING(255))
|
||||
name: string;
|
||||
public async talk(text: string) {
|
||||
return await this.context.sendActivity(text);
|
||||
}
|
||||
|
||||
@Column(DataType.STRING(255))
|
||||
schedule: string;
|
||||
/**
|
||||
* Generic function to call any REST API.
|
||||
*/
|
||||
public sendEmail(to, subject, body) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(`[E-mail]: to:${to}, subject: ${subject}, body: ${body}.`);
|
||||
}
|
||||
|
||||
@ForeignKey(() => GuaribasInstance)
|
||||
@Column(DataType.INTEGER)
|
||||
instanceId: number;
|
||||
|
||||
@BelongsTo(() => GuaribasInstance)
|
||||
instance: GuaribasInstance;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@CreatedAt
|
||||
declare createdAt: Date;
|
||||
|
||||
@Column(DataType.DATE)
|
||||
@UpdatedAt
|
||||
declare updatedAt: Date;
|
||||
/**
|
||||
* Generic function to call any REST API.
|
||||
*/
|
||||
public post(url: string, data) {}
|
||||
}
|