@botonic/cli 0.40.1 → 0.41.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -175
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +5 -0
- package/bin/run.js +5 -0
- package/lib/{botonic-api-service.d.ts → src/botonic-api-service.d.ts} +3 -3
- package/lib/src/botonic-api-service.js +245 -0
- package/lib/src/botonic-api-service.js.map +1 -0
- package/lib/src/botonic-examples.d.ts +2 -0
- package/lib/src/botonic-examples.js +28 -0
- package/lib/src/botonic-examples.js.map +1 -0
- package/lib/{commands → src/commands}/deploy.d.ts +13 -22
- package/lib/src/commands/deploy.js +346 -0
- package/lib/src/commands/deploy.js.map +1 -0
- package/lib/src/commands/login.d.ts +11 -0
- package/lib/src/commands/login.js +33 -0
- package/lib/src/commands/login.js.map +1 -0
- package/lib/src/commands/logout.d.ts +11 -0
- package/lib/src/commands/logout.js +22 -0
- package/lib/src/commands/logout.js.map +1 -0
- package/lib/{commands → src/commands}/new.d.ts +8 -11
- package/lib/src/commands/new.js +134 -0
- package/lib/src/commands/new.js.map +1 -0
- package/lib/{commands → src/commands}/serve.d.ts +3 -3
- package/lib/src/commands/serve.js +22 -0
- package/lib/src/commands/serve.js.map +1 -0
- package/lib/src/constants.js +7 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/index.d.ts +1 -0
- package/lib/src/index.js +2 -0
- package/lib/src/index.js.map +1 -0
- package/lib/{interfaces.d.ts → src/interfaces.d.ts} +9 -0
- package/lib/src/interfaces.js +2 -0
- package/lib/{interfaces.js.map → src/interfaces.js.map} +1 -1
- package/lib/src/util/bot-config.js +98 -0
- package/lib/src/util/bot-config.js.map +1 -0
- package/lib/{analytics → src/util}/credentials-handler.d.ts +1 -1
- package/lib/src/util/credentials-handler.js +73 -0
- package/lib/src/util/credentials-handler.js.map +1 -0
- package/lib/src/util/download-gzip.js +71 -0
- package/lib/src/util/download-gzip.js.map +1 -0
- package/lib/{util → src/util}/environment-info.d.ts +1 -1
- package/lib/src/util/environment-info.js +46 -0
- package/lib/src/util/environment-info.js.map +1 -0
- package/lib/{util → src/util}/file-system.d.ts +2 -2
- package/lib/src/util/file-system.js +45 -0
- package/lib/src/util/file-system.js.map +1 -0
- package/lib/src/util/system.js +32 -0
- package/lib/src/util/system.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/oclif.manifest.json +191 -1
- package/package.json +43 -36
- package/bin/run +0 -5
- package/lib/analytics/credentials-handler.js +0 -77
- package/lib/analytics/credentials-handler.js.map +0 -1
- package/lib/botonic-api-service.js +0 -274
- package/lib/botonic-api-service.js.map +0 -1
- package/lib/botonic-examples.d.ts +0 -2
- package/lib/botonic-examples.js +0 -76
- package/lib/botonic-examples.js.map +0 -1
- package/lib/commands/deploy.js +0 -422
- package/lib/commands/deploy.js.map +0 -1
- package/lib/commands/login.d.ts +0 -16
- package/lib/commands/login.js +0 -47
- package/lib/commands/login.js.map +0 -1
- package/lib/commands/logout.d.ts +0 -11
- package/lib/commands/logout.js +0 -29
- package/lib/commands/logout.js.map +0 -1
- package/lib/commands/new.js +0 -159
- package/lib/commands/new.js.map +0 -1
- package/lib/commands/serve.js +0 -28
- package/lib/commands/serve.js.map +0 -1
- package/lib/commands/test.d.ts +0 -8
- package/lib/commands/test.js +0 -43
- package/lib/commands/test.js.map +0 -1
- package/lib/constants.js +0 -10
- package/lib/constants.js.map +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +0 -1
- package/lib/interfaces.js +0 -3
- package/lib/util/bot-config.js +0 -114
- package/lib/util/bot-config.js.map +0 -1
- package/lib/util/download-gzip.js +0 -87
- package/lib/util/download-gzip.js.map +0 -1
- package/lib/util/environment-info.js +0 -53
- package/lib/util/environment-info.js.map +0 -1
- package/lib/util/file-system.js +0 -59
- package/lib/util/file-system.js.map +0 -1
- package/lib/util/system.js +0 -43
- package/lib/util/system.js.map +0 -1
- package/scripts/postinstall.js +0 -13
- /package/lib/{constants.d.ts → src/constants.d.ts} +0 -0
- /package/lib/{util → src/util}/bot-config.d.ts +0 -0
- /package/lib/{util → src/util}/download-gzip.d.ts +0 -0
- /package/lib/{util → src/util}/system.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,176 +1 @@
|
|
|
1
|
-
# @botonic/cli
|
|
2
1
|
|
|
3
|
-
Build Chatbots Using React
|
|
4
|
-
|
|
5
|
-
[](https://oclif.io)
|
|
6
|
-
[](https://npmjs.org/package/@botonic/cli)
|
|
7
|
-
[](https://npmjs.org/package/@botonic/cli)
|
|
8
|
-
[](https://github.com/hubtype/botonic/blob/master/package.json)
|
|
9
|
-
|
|
10
|
-
<!-- toc -->
|
|
11
|
-
* [@botonic/cli](#botoniccli)
|
|
12
|
-
* [Usage](#usage)
|
|
13
|
-
* [Commands](#commands)
|
|
14
|
-
<!-- tocstop -->
|
|
15
|
-
|
|
16
|
-
# Usage
|
|
17
|
-
|
|
18
|
-
<!-- usage -->
|
|
19
|
-
```sh-session
|
|
20
|
-
$ npm install -g @botonic/cli
|
|
21
|
-
$ botonic COMMAND
|
|
22
|
-
running command...
|
|
23
|
-
$ botonic (-v|--version|version)
|
|
24
|
-
@botonic/cli/0.40.1 darwin-arm64 node-v22.19.0
|
|
25
|
-
$ botonic --help [COMMAND]
|
|
26
|
-
USAGE
|
|
27
|
-
$ botonic COMMAND
|
|
28
|
-
...
|
|
29
|
-
```
|
|
30
|
-
<!-- usagestop -->
|
|
31
|
-
|
|
32
|
-
# Commands
|
|
33
|
-
|
|
34
|
-
<!-- commands -->
|
|
35
|
-
* [`botonic deploy [PROVIDER]`](#botonic-deploy-provider)
|
|
36
|
-
* [`botonic help [COMMAND]`](#botonic-help-command)
|
|
37
|
-
* [`botonic login`](#botonic-login)
|
|
38
|
-
* [`botonic logout`](#botonic-logout)
|
|
39
|
-
* [`botonic new NAME [PROJECTNAME]`](#botonic-new-name-projectname)
|
|
40
|
-
* [`botonic serve`](#botonic-serve)
|
|
41
|
-
* [`botonic test`](#botonic-test)
|
|
42
|
-
|
|
43
|
-
## `botonic deploy [PROVIDER]`
|
|
44
|
-
|
|
45
|
-
Deploy Botonic project to cloud provider
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
USAGE
|
|
49
|
-
$ botonic deploy [PROVIDER]
|
|
50
|
-
|
|
51
|
-
OPTIONS
|
|
52
|
-
-b, --botName=botName Name of the bot from Hubtype where you want to deploy
|
|
53
|
-
-c, --command=command Command to execute from the package "scripts" object
|
|
54
|
-
-e, --email=email Email from Hubtype Organization
|
|
55
|
-
-p, --password=password Password from Hubtype Organization
|
|
56
|
-
|
|
57
|
-
EXAMPLES
|
|
58
|
-
$ botonic deploy
|
|
59
|
-
Building...
|
|
60
|
-
Creating bundle...
|
|
61
|
-
Uploading...
|
|
62
|
-
🚀 Bot deployed!
|
|
63
|
-
|
|
64
|
-
$ botonic deploy aws
|
|
65
|
-
Deploying to AWS...
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
_See code: [lib/commands/deploy.js](https://github.com/hubtype/botonic/blob/v0.40.1/lib/commands/deploy.js)_
|
|
69
|
-
|
|
70
|
-
## `botonic help [COMMAND]`
|
|
71
|
-
|
|
72
|
-
display help for botonic
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
USAGE
|
|
76
|
-
$ botonic help [COMMAND]
|
|
77
|
-
|
|
78
|
-
ARGUMENTS
|
|
79
|
-
COMMAND command to show help for
|
|
80
|
-
|
|
81
|
-
OPTIONS
|
|
82
|
-
--all see all commands in CLI
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.18/src/commands/help.ts)_
|
|
86
|
-
|
|
87
|
-
## `botonic login`
|
|
88
|
-
|
|
89
|
-
Log in to Botonic
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
USAGE
|
|
93
|
-
$ botonic login
|
|
94
|
-
|
|
95
|
-
OPTIONS
|
|
96
|
-
-p, --path=path Path to botonic project. Defaults to current dir.
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
_See code: [lib/commands/login.js](https://github.com/hubtype/botonic/blob/v0.40.1/lib/commands/login.js)_
|
|
100
|
-
|
|
101
|
-
## `botonic logout`
|
|
102
|
-
|
|
103
|
-
Log out of Botonic
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
USAGE
|
|
107
|
-
$ botonic logout
|
|
108
|
-
|
|
109
|
-
OPTIONS
|
|
110
|
-
-p, --path=path Path to botonic project. Defaults to current dir.
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
_See code: [lib/commands/logout.js](https://github.com/hubtype/botonic/blob/v0.40.1/lib/commands/logout.js)_
|
|
114
|
-
|
|
115
|
-
## `botonic new NAME [PROJECTNAME]`
|
|
116
|
-
|
|
117
|
-
Create a new Botonic project
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
USAGE
|
|
121
|
-
$ botonic new NAME [PROJECTNAME]
|
|
122
|
-
|
|
123
|
-
ARGUMENTS
|
|
124
|
-
NAME name of the bot folder
|
|
125
|
-
PROJECTNAME OPTIONAL name of the bot project
|
|
126
|
-
|
|
127
|
-
EXAMPLE
|
|
128
|
-
$ botonic new test_bot
|
|
129
|
-
Creating...
|
|
130
|
-
✨ test_bot was successfully created!
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
_See code: [lib/commands/new.js](https://github.com/hubtype/botonic/blob/v0.40.1/lib/commands/new.js)_
|
|
134
|
-
|
|
135
|
-
## `botonic serve`
|
|
136
|
-
|
|
137
|
-
Serve your bot in your localhost
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
USAGE
|
|
141
|
-
$ botonic serve
|
|
142
|
-
|
|
143
|
-
EXAMPLE
|
|
144
|
-
$ botonic serve
|
|
145
|
-
> Project is running at http://localhost:8080/
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
_See code: [lib/commands/serve.js](https://github.com/hubtype/botonic/blob/v0.40.1/lib/commands/serve.js)_
|
|
149
|
-
|
|
150
|
-
## `botonic test`
|
|
151
|
-
|
|
152
|
-
Test your Botonic components
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
USAGE
|
|
156
|
-
$ botonic test
|
|
157
|
-
|
|
158
|
-
EXAMPLE
|
|
159
|
-
PASS tests/app.test.js
|
|
160
|
-
✓ TEST: hi.js (10ms)
|
|
161
|
-
✓ TEST: pizza.js (1ms)
|
|
162
|
-
✓ TEST: sausage.js (1ms)
|
|
163
|
-
✓ TEST: bacon.js
|
|
164
|
-
✓ TEST: pasta.js (1ms)
|
|
165
|
-
✓ TEST: cheese.js (1ms)
|
|
166
|
-
✓ TEST: tomato.js
|
|
167
|
-
|
|
168
|
-
Test Suites: 1 passed, 1 total
|
|
169
|
-
Tests: 7 passed, 7 total
|
|
170
|
-
Snapshots: 0 total
|
|
171
|
-
Time: 1.223s
|
|
172
|
-
Ran all test suites.
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
_See code: [lib/commands/test.js](https://github.com/hubtype/botonic/blob/v0.40.1/lib/commands/test.js)_
|
|
176
|
-
<!-- commandsstop -->
|
package/bin/dev.cmd
ADDED
package/bin/dev.js
ADDED
package/bin/run.js
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosHeaders, AxiosInstance, AxiosPromise, AxiosResponse } from 'axios';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { BotDetail, BotListItem, Me, OAuth, PaginatedResponse } from './interfaces.js';
|
|
3
|
+
import { BotConfigJSON } from './util/bot-config.js';
|
|
4
|
+
import { BotCredentialsHandler, GlobalCredentialsHandler } from './util/credentials-handler.js';
|
|
5
5
|
export declare class BotonicAPIService {
|
|
6
6
|
clientId: string;
|
|
7
7
|
baseUrl: string;
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import axios, { AxiosHeaders, } from 'axios';
|
|
3
|
+
import childProcess from 'child_process';
|
|
4
|
+
import pc from 'picocolors';
|
|
5
|
+
import FormData from 'form-data';
|
|
6
|
+
import { createReadStream, unlinkSync } from 'fs';
|
|
7
|
+
import ora from 'ora';
|
|
8
|
+
import { stringify } from 'qs';
|
|
9
|
+
import * as util from 'util';
|
|
10
|
+
import { BotCredentialsHandler, GlobalCredentialsHandler, } from './util/credentials-handler.js';
|
|
11
|
+
import { pathExists } from './util/file-system.js';
|
|
12
|
+
const exec = util.promisify(childProcess.exec);
|
|
13
|
+
const BOTONIC_CLIENT_ID = process.env.BOTONIC_CLIENT_ID || 'jOIYDdvcfwqwSs7ZJ1CpmTKcE7UDapZDOSobFmEp';
|
|
14
|
+
const BOTONIC_URL = process.env.BOTONIC_URL || 'https://api.hubtype.com';
|
|
15
|
+
export class BotonicAPIService {
|
|
16
|
+
clientId = BOTONIC_CLIENT_ID;
|
|
17
|
+
baseUrl = BOTONIC_URL;
|
|
18
|
+
loginUrl = this.baseUrl + '/o/token/';
|
|
19
|
+
botCredentialsHandler = new BotCredentialsHandler();
|
|
20
|
+
globalCredentialsHandler = new GlobalCredentialsHandler();
|
|
21
|
+
oauth;
|
|
22
|
+
me;
|
|
23
|
+
bot = null;
|
|
24
|
+
headers = new AxiosHeaders();
|
|
25
|
+
apiClient;
|
|
26
|
+
constructor() {
|
|
27
|
+
this.loadGlobalCredentials();
|
|
28
|
+
this.loadBotCredentials();
|
|
29
|
+
this.setHeaders(this.oauth?.access_token);
|
|
30
|
+
this.apiClient = axios.create({
|
|
31
|
+
baseURL: BOTONIC_URL,
|
|
32
|
+
headers: this.headers,
|
|
33
|
+
});
|
|
34
|
+
const onFulfilled = (response) => {
|
|
35
|
+
return response;
|
|
36
|
+
};
|
|
37
|
+
const onRejected = async (error) => {
|
|
38
|
+
const originalRequest = error.config;
|
|
39
|
+
const retry = originalRequest?._retry;
|
|
40
|
+
if (error.response?.status === 401 && !retry) {
|
|
41
|
+
originalRequest._retry = true;
|
|
42
|
+
await this.refreshToken();
|
|
43
|
+
const nextRequest = { ...originalRequest, headers: this.headers };
|
|
44
|
+
return this.apiClient.request(nextRequest);
|
|
45
|
+
}
|
|
46
|
+
return Promise.reject(error);
|
|
47
|
+
};
|
|
48
|
+
this.apiClient.interceptors.response.use(onFulfilled, onRejected);
|
|
49
|
+
}
|
|
50
|
+
beforeExit() {
|
|
51
|
+
this.saveGlobalCredentials();
|
|
52
|
+
this.saveBotCredentials();
|
|
53
|
+
}
|
|
54
|
+
botInfo() {
|
|
55
|
+
if (!this.bot) {
|
|
56
|
+
throw new Error('Not bot info available');
|
|
57
|
+
}
|
|
58
|
+
return this.bot;
|
|
59
|
+
}
|
|
60
|
+
getOauth() {
|
|
61
|
+
if (!this.oauth) {
|
|
62
|
+
throw new Error('Not OAuth available');
|
|
63
|
+
}
|
|
64
|
+
return this.oauth;
|
|
65
|
+
}
|
|
66
|
+
loadGlobalCredentials() {
|
|
67
|
+
const credentials = this.globalCredentialsHandler.load();
|
|
68
|
+
if (credentials) {
|
|
69
|
+
this.oauth = credentials.oauth;
|
|
70
|
+
this.me = credentials.me;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
loadBotCredentials() {
|
|
74
|
+
const credentials = this.botCredentialsHandler.load();
|
|
75
|
+
if (credentials?.bot) {
|
|
76
|
+
this.bot = credentials.bot;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
setHeaders(accessToken) {
|
|
80
|
+
if (accessToken) {
|
|
81
|
+
this.headers = new AxiosHeaders({
|
|
82
|
+
Authorization: `Bearer ${accessToken}`,
|
|
83
|
+
'content-type': 'application/json',
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
saveGlobalCredentials() {
|
|
88
|
+
this.globalCredentialsHandler.createDirIfNotExists();
|
|
89
|
+
this.globalCredentialsHandler.dump({ oauth: this.oauth, me: this.me });
|
|
90
|
+
}
|
|
91
|
+
saveBotCredentials() {
|
|
92
|
+
this.botCredentialsHandler.dump({ bot: this.bot });
|
|
93
|
+
}
|
|
94
|
+
async build(npmCommand = 'build') {
|
|
95
|
+
const spinner = ora({ text: 'Building...', spinner: 'bouncingBar' }).start();
|
|
96
|
+
try {
|
|
97
|
+
await exec(`npm run ${npmCommand}`);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
spinner.fail();
|
|
101
|
+
console.log(`${String(error.stdout)}` + pc.red(`\n\nBuild error:\n${String(error)}`));
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
spinner.succeed();
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
setCurrentBot(bot) {
|
|
108
|
+
this.bot = bot;
|
|
109
|
+
}
|
|
110
|
+
logout() {
|
|
111
|
+
const pathToCredentials = this.globalCredentialsHandler.pathToCredentials;
|
|
112
|
+
if (pathExists(pathToCredentials))
|
|
113
|
+
unlinkSync(pathToCredentials);
|
|
114
|
+
}
|
|
115
|
+
async apiPost({ apiVersion = 'v1', path, body, headers, params, }) {
|
|
116
|
+
return this.apiClient.post(`${this.baseUrl}/${apiVersion}/${path}`, body, { headers: headers || this.headers, params });
|
|
117
|
+
}
|
|
118
|
+
async apiGet({ apiVersion = 'v1', path, headers, params, }) {
|
|
119
|
+
return this.apiClient.get(`${this.baseUrl}/${apiVersion}/${path}`, {
|
|
120
|
+
headers: headers || this.headers,
|
|
121
|
+
params,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async refreshToken() {
|
|
125
|
+
const data = stringify({
|
|
126
|
+
callback: 'none',
|
|
127
|
+
grant_type: 'refresh_token',
|
|
128
|
+
refresh_token: this.getOauth().refresh_token,
|
|
129
|
+
client_id: this.clientId,
|
|
130
|
+
});
|
|
131
|
+
const oauthResponse = await axios.post(this.loginUrl, data, {
|
|
132
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
133
|
+
});
|
|
134
|
+
if (oauthResponse.status !== 200) {
|
|
135
|
+
throw new Error('Error refreshing token');
|
|
136
|
+
}
|
|
137
|
+
this.oauth = oauthResponse.data;
|
|
138
|
+
const accessToken = this.getOauth().access_token;
|
|
139
|
+
this.setHeaders(accessToken);
|
|
140
|
+
this.saveGlobalCredentials();
|
|
141
|
+
}
|
|
142
|
+
async login(email, password) {
|
|
143
|
+
const data = stringify({
|
|
144
|
+
username: email,
|
|
145
|
+
password: password,
|
|
146
|
+
grant_type: 'password',
|
|
147
|
+
client_id: this.clientId,
|
|
148
|
+
});
|
|
149
|
+
const loginResponse = await axios.post(this.loginUrl, data, {
|
|
150
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
151
|
+
});
|
|
152
|
+
this.oauth = loginResponse.data;
|
|
153
|
+
const accessToken = this.getOauth().access_token;
|
|
154
|
+
this.setHeaders(accessToken);
|
|
155
|
+
const meResponse = await this.getMe();
|
|
156
|
+
if (meResponse) {
|
|
157
|
+
this.me = meResponse.data;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
signup(email, password, orgName, campaign) {
|
|
161
|
+
const signupData = { email, password, org_name: orgName, campaign };
|
|
162
|
+
return this.apiPost({ path: 'sign-up/', body: signupData });
|
|
163
|
+
}
|
|
164
|
+
async createBot(botName) {
|
|
165
|
+
const resp = await this.apiPost({
|
|
166
|
+
apiVersion: 'v2',
|
|
167
|
+
path: 'bots/',
|
|
168
|
+
body: { name: botName },
|
|
169
|
+
});
|
|
170
|
+
if (resp.data) {
|
|
171
|
+
this.setCurrentBot(resp.data);
|
|
172
|
+
}
|
|
173
|
+
return resp;
|
|
174
|
+
}
|
|
175
|
+
async getMe() {
|
|
176
|
+
return this.apiGet({ path: 'users/me/', apiVersion: 'v3' });
|
|
177
|
+
}
|
|
178
|
+
async getBots() {
|
|
179
|
+
const botsResponse = await this.apiGet({
|
|
180
|
+
apiVersion: 'v2',
|
|
181
|
+
path: 'bots/?page_size=100',
|
|
182
|
+
});
|
|
183
|
+
if (botsResponse.data.next) {
|
|
184
|
+
await this.getMoreBots(botsResponse.data.results, botsResponse.data.next);
|
|
185
|
+
}
|
|
186
|
+
return botsResponse;
|
|
187
|
+
}
|
|
188
|
+
async getMoreBots(bots, nextUrl) {
|
|
189
|
+
if (!nextUrl) {
|
|
190
|
+
return bots;
|
|
191
|
+
}
|
|
192
|
+
const resp = await this.apiGet({
|
|
193
|
+
apiVersion: 'v2',
|
|
194
|
+
path: nextUrl.split(`${this.baseUrl}/v2/`)[1],
|
|
195
|
+
});
|
|
196
|
+
resp.data.results.forEach(bot => bots.push(bot));
|
|
197
|
+
nextUrl = resp.data.next;
|
|
198
|
+
return this.getMoreBots(bots, nextUrl);
|
|
199
|
+
}
|
|
200
|
+
async getProviders() {
|
|
201
|
+
return this.apiGet({
|
|
202
|
+
path: 'provider_accounts/',
|
|
203
|
+
params: { bot_id: this.botInfo().id },
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
async deployBot(bundlePath, botConfigJson) {
|
|
207
|
+
try {
|
|
208
|
+
await this.getMe();
|
|
209
|
+
}
|
|
210
|
+
catch (e) {
|
|
211
|
+
console.log(`Error authenticating: ${String(e)}`);
|
|
212
|
+
}
|
|
213
|
+
const form = new FormData();
|
|
214
|
+
const data = createReadStream(bundlePath);
|
|
215
|
+
form.append('bundle', data, 'botonic_bundle.zip');
|
|
216
|
+
form.append('bot_config', JSON.stringify(botConfigJson));
|
|
217
|
+
const headers = await this.getHeaders(form);
|
|
218
|
+
return await this.apiPost({
|
|
219
|
+
apiVersion: 'v2',
|
|
220
|
+
path: `bots/${this.botInfo().id}/deploy/`,
|
|
221
|
+
body: form,
|
|
222
|
+
headers: { ...this.headers, ...headers },
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
async deployStatus(deployId) {
|
|
226
|
+
return this.apiGet({
|
|
227
|
+
apiVersion: 'v2',
|
|
228
|
+
path: `bots/${this.botInfo().id}/deploy_status/`,
|
|
229
|
+
params: { deploy_id: deployId },
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
async getHeaders(form) {
|
|
233
|
+
//https://github.com/axios/axios/issues/1006#issuecomment-352071490
|
|
234
|
+
return new Promise((resolve, reject) => {
|
|
235
|
+
form.getLength((err, length) => {
|
|
236
|
+
if (err) {
|
|
237
|
+
reject(err);
|
|
238
|
+
}
|
|
239
|
+
const headers = Object.assign({ 'Content-Length': length }, form.getHeaders());
|
|
240
|
+
resolve(headers);
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=botonic-api-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"botonic-api-service.js","sourceRoot":"","sources":["../../src/botonic-api-service.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,KAAK,EAAE,EACZ,YAAY,GAIb,MAAM,OAAO,CAAA;AACd,OAAO,YAAY,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,QAAQ,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AACjD,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAU5B,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;AAE9C,MAAM,iBAAiB,GACrB,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,0CAA0C,CAAA;AAC7E,MAAM,WAAW,GAAW,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,yBAAyB,CAAA;AAShF,MAAM,OAAO,iBAAiB;I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AAiB;YAChD,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;SAChC,CAAC,CAAA;IACJ,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,IAAc;QACrC,mEAAmE;QACnE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAQ,EAAE,MAAc,EAAE,EAAE;gBAC1C,IAAI,GAAG,EAAE,CAAC;oBACR,MAAM,CAAC,GAAG,CAAC,CAAA;gBACb,CAAC;gBACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAC3B,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAC5B,IAAI,CAAC,UAAU,EAAE,CAClB,CAAA;gBACD,OAAO,CAAC,OAAO,CAAC,CAAA;YAClB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { dirname } from 'path';
|
|
4
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
5
|
+
const __dirname = dirname(__filename);
|
|
6
|
+
const exampleTestPath = path.resolve(__dirname, '..', '..', '..', 'examples');
|
|
7
|
+
const exampleVersion = '0.40.0';
|
|
8
|
+
export const EXAMPLES = [
|
|
9
|
+
{
|
|
10
|
+
name: 'blank',
|
|
11
|
+
description: 'Blank: A minimal template to start from scratch',
|
|
12
|
+
version: exampleVersion,
|
|
13
|
+
localTestPath: path.resolve(exampleTestPath, 'blank'),
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'blank-typescript',
|
|
17
|
+
description: 'Blank (TypeScript): A minimal template to start from scratch',
|
|
18
|
+
version: exampleVersion,
|
|
19
|
+
localTestPath: path.resolve(exampleTestPath, 'blank-typescript'),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'flow-builder-typescript',
|
|
23
|
+
description: 'Flow Builder (TypeScript): A minimal template to start from scratch',
|
|
24
|
+
version: exampleVersion,
|
|
25
|
+
localTestPath: path.resolve(exampleTestPath, 'flow-builder-typescript'),
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
//# sourceMappingURL=botonic-examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"botonic-examples.js","sourceRoot":"","sources":["../../src/botonic-examples.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAI9B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AACrC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAA;AAC7E,MAAM,cAAc,GAAG,QAAQ,CAAA;AAE/B,MAAM,CAAC,MAAM,QAAQ,GAAqB;IACxC;QACE,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,iDAAiD;QAC9D,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC;KACtD;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,8DAA8D;QAC3E,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,kBAAkB,CAAC;KACjE;IACD;QACE,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EACT,qEAAqE;QACvE,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,yBAAyB,CAAC;KACxE;CACF,CAAA"}
|
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
import { Command
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export default class Run extends Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { BotListItem, DeployHubtypeFlags } from '../interfaces.js';
|
|
3
|
+
import { BotConfigJSON } from '../util/bot-config.js';
|
|
4
|
+
export default class Deploy extends Command {
|
|
5
|
+
static args: {
|
|
6
|
+
provider: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
10
8
|
static description: string;
|
|
11
9
|
static examples: string[];
|
|
12
10
|
static flags: {
|
|
13
|
-
command:
|
|
14
|
-
email:
|
|
15
|
-
password:
|
|
16
|
-
botName:
|
|
11
|
+
command: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
email: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
password: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
botName: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
15
|
};
|
|
18
|
-
static args: {
|
|
19
|
-
name: string;
|
|
20
|
-
options: "hubtype"[];
|
|
21
|
-
}[];
|
|
22
16
|
private botonicApiService;
|
|
23
17
|
private botName;
|
|
24
18
|
run(): Promise<void>;
|
|
@@ -34,7 +28,7 @@ export default class Run extends Command {
|
|
|
34
28
|
deployBotFlow(): Promise<void>;
|
|
35
29
|
login(email: string, password: string): Promise<void>;
|
|
36
30
|
signup(email: string, password: string): Promise<void>;
|
|
37
|
-
getAvailableBots(): Promise<
|
|
31
|
+
getAvailableBots(): Promise<BotListItem[]>;
|
|
38
32
|
newBotFlow(): Promise<void>;
|
|
39
33
|
createNewBotWithName(inpBotName: string): Promise<void>;
|
|
40
34
|
createNewBot(botName?: string): Promise<void>;
|
|
@@ -47,9 +41,6 @@ export default class Run extends Command {
|
|
|
47
41
|
deployBundle(botConfigJson: BotConfigJSON): Promise<{
|
|
48
42
|
hasDeployErrors: boolean;
|
|
49
43
|
}>;
|
|
50
|
-
displayDeployResults(
|
|
51
|
-
hasDeployErrors: any;
|
|
52
|
-
}): Promise<boolean>;
|
|
44
|
+
displayDeployResults(hasDeployErrors: boolean): Promise<boolean>;
|
|
53
45
|
deploy(): Promise<void>;
|
|
54
46
|
}
|
|
55
|
-
export {};
|