bdy 1.16.34-dev → 1.16.35-dev
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/distTs/package.json +1 -1
- package/distTs/src/api/client.js +1 -1
- package/distTs/src/command/api/delete.js +9 -0
- package/distTs/src/command/api/get.js +9 -0
- package/distTs/src/command/api/patch.js +9 -0
- package/distTs/src/command/api/post.js +9 -0
- package/distTs/src/command/api/put.js +9 -0
- package/distTs/src/command/api/request.js +170 -0
- package/distTs/src/command/api.js +10 -0
- package/distTs/src/command/login.js +20 -2
- package/distTs/src/input.js +3 -1
- package/distTs/src/texts.js +25 -3
- package/package.json +1 -1
package/distTs/package.json
CHANGED
package/distTs/src/api/client.js
CHANGED
|
@@ -643,7 +643,7 @@ class ApiClient {
|
|
|
643
643
|
form.append('file', file);
|
|
644
644
|
return await this.request({
|
|
645
645
|
method: 'POST',
|
|
646
|
-
path: `/workspaces/${encodeURIComponent(workspace)}/packages/${encodeURIComponent(pkgId)}/versions/${versionId}/upload`,
|
|
646
|
+
path: `/workspaces/${encodeURIComponent(workspace)}/packages/${encodeURIComponent(pkgId)}/versions/${encodeURIComponent(versionId)}/upload`,
|
|
647
647
|
body: form,
|
|
648
648
|
parseResponseBody: true,
|
|
649
649
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const request_1 = __importDefault(require("./request"));
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const commandApiDelete = (0, request_1.default)('delete', texts_1.DESC_COMMAND_API_DELETE, true);
|
|
9
|
+
exports.default = commandApiDelete;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const request_1 = __importDefault(require("./request"));
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const commandApiGet = (0, request_1.default)('get', texts_1.DESC_COMMAND_API_GET, false);
|
|
9
|
+
exports.default = commandApiGet;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const request_1 = __importDefault(require("./request"));
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const commandApiPatch = (0, request_1.default)('patch', texts_1.DESC_COMMAND_API_PATCH, true);
|
|
9
|
+
exports.default = commandApiPatch;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const texts_1 = require("../../texts");
|
|
7
|
+
const request_1 = __importDefault(require("./request"));
|
|
8
|
+
const commandApiPost = (0, request_1.default)('post', texts_1.DESC_COMMAND_API_POST, true);
|
|
9
|
+
exports.default = commandApiPost;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const request_1 = __importDefault(require("./request"));
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const commandApiPut = (0, request_1.default)('put', texts_1.DESC_COMMAND_API_PUT, true);
|
|
9
|
+
exports.default = commandApiPut;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const utils_1 = require("../../utils");
|
|
7
|
+
const texts_1 = require("../../texts");
|
|
8
|
+
const output_1 = __importDefault(require("../../output"));
|
|
9
|
+
const input_1 = __importDefault(require("../../input"));
|
|
10
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
|
+
const promises_1 = require("node:stream/promises");
|
|
12
|
+
const path_1 = require("path");
|
|
13
|
+
const undici_1 = require("undici");
|
|
14
|
+
const tryReadFile = async (filePath) => {
|
|
15
|
+
try {
|
|
16
|
+
return await node_fs_1.default.promises.readFile(filePath, 'utf8');
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
output_1.default.exitError(texts_1.ERR_API_REQUEST_FILE_ERROR);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const tryOpenAsBlob = async (filePath) => {
|
|
23
|
+
try {
|
|
24
|
+
return await node_fs_1.default.openAsBlob(filePath);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
output_1.default.exitError(texts_1.ERR_API_REQUEST_FILE_ERROR);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const prepareJsonBody = async (json) => {
|
|
31
|
+
let data;
|
|
32
|
+
if (json.startsWith('@')) {
|
|
33
|
+
data = await tryReadFile(json.replace(/^@/, ''));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
data = json;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(data);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
output_1.default.exitError(texts_1.ERR_API_REQUEST_INVALID_JSON);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const prepareEncodedBody = async (params) => {
|
|
46
|
+
const obj = {};
|
|
47
|
+
for (let i = 0; i < params.length; i += 1) {
|
|
48
|
+
const s = params[i].split(':');
|
|
49
|
+
if (s.length !== 2) {
|
|
50
|
+
output_1.default.exitError(texts_1.ERR_API_REQUEST_BODY_VALUE);
|
|
51
|
+
}
|
|
52
|
+
const [key, value] = s;
|
|
53
|
+
if (value.startsWith('@')) {
|
|
54
|
+
obj[key] = await tryReadFile(value.replace(/^@/, ''));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
obj[key] = value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
};
|
|
62
|
+
const prepareMultipartBody = async (params) => {
|
|
63
|
+
const form = new undici_1.FormData();
|
|
64
|
+
for (let i = 0; i < params.length; i += 1) {
|
|
65
|
+
const s = params[i].split(':');
|
|
66
|
+
if (s.length !== 2) {
|
|
67
|
+
output_1.default.exitError(texts_1.ERR_API_REQUEST_BODY_VALUE);
|
|
68
|
+
}
|
|
69
|
+
const [key, value] = s;
|
|
70
|
+
if (value.startsWith('@')) {
|
|
71
|
+
const blob = await tryOpenAsBlob(value.replace(/^@/, ''));
|
|
72
|
+
form.set(key, blob);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
form.set(key, value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return form;
|
|
79
|
+
};
|
|
80
|
+
const request = async (method, url, options) => {
|
|
81
|
+
output_1.default.handleSignals();
|
|
82
|
+
const workspace = input_1.default.restApiWorkspace(options.workspace, true);
|
|
83
|
+
const project = input_1.default.restApiProject(options.project, true);
|
|
84
|
+
const client = input_1.default.restApiTokenClient(options.api, options.region, options.token);
|
|
85
|
+
const query = {};
|
|
86
|
+
if (options.query) {
|
|
87
|
+
options.query.forEach((q) => {
|
|
88
|
+
const s = q.split(':');
|
|
89
|
+
if (s.length !== 2) {
|
|
90
|
+
output_1.default.exitError((0, texts_1.ERR_API_REQUEST_QUERY_VALUE)(q));
|
|
91
|
+
}
|
|
92
|
+
query[s[0]] = s[1];
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
let preparedUrl = url;
|
|
96
|
+
if (workspace) {
|
|
97
|
+
preparedUrl = preparedUrl.replaceAll('{workspace_domain}', encodeURIComponent(workspace));
|
|
98
|
+
}
|
|
99
|
+
if (project) {
|
|
100
|
+
preparedUrl = preparedUrl.replaceAll('{project_name}', encodeURIComponent(project));
|
|
101
|
+
}
|
|
102
|
+
const m = preparedUrl.match(/{[^}]*}/g);
|
|
103
|
+
if (m) {
|
|
104
|
+
output_1.default.exitError((0, texts_1.ERR_API_PARAMETER_NOT_REPLACED)(m[0]));
|
|
105
|
+
}
|
|
106
|
+
let filePath;
|
|
107
|
+
if (options.output) {
|
|
108
|
+
const fp = (0, path_1.resolve)(options.output);
|
|
109
|
+
try {
|
|
110
|
+
await node_fs_1.default.promises.stat(fp);
|
|
111
|
+
output_1.default.exitError(texts_1.ERR_API_REQUEST_OUTPUT_EXISTS);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
filePath = fp;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const opts = {
|
|
118
|
+
method: method.toUpperCase(),
|
|
119
|
+
path: preparedUrl,
|
|
120
|
+
query,
|
|
121
|
+
rawResponseBody: true,
|
|
122
|
+
};
|
|
123
|
+
if (options.data && options.data.length > 0) {
|
|
124
|
+
opts.httpUrlEncoded = true;
|
|
125
|
+
opts.body = await prepareEncodedBody(options.data);
|
|
126
|
+
}
|
|
127
|
+
else if (options.form && options.form.length > 0) {
|
|
128
|
+
opts.body = await prepareMultipartBody(options.form);
|
|
129
|
+
}
|
|
130
|
+
else if (options.json) {
|
|
131
|
+
opts.body = await prepareJsonBody(options.json);
|
|
132
|
+
}
|
|
133
|
+
const body = await client.request(opts);
|
|
134
|
+
if (filePath) {
|
|
135
|
+
const ws = node_fs_1.default.createWriteStream(filePath);
|
|
136
|
+
await (0, promises_1.pipeline)(body, ws);
|
|
137
|
+
output_1.default.exitNormal('');
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
body.on('data', (data) => {
|
|
141
|
+
output_1.default.normal(data.toString('utf8'));
|
|
142
|
+
});
|
|
143
|
+
body.on('close', () => {
|
|
144
|
+
output_1.default.exitNormal('');
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const newApiRequestCommand = (method, description, allowBody) => {
|
|
149
|
+
const command = (0, utils_1.newCommand)(method, description);
|
|
150
|
+
command.hideVersionUpdate = true;
|
|
151
|
+
command.alias(method.toUpperCase());
|
|
152
|
+
command.option('--token <token>', texts_1.OPTION_REST_API_TOKEN);
|
|
153
|
+
command.option('--api <url>', texts_1.OPTION_REST_API_ENDPOINT);
|
|
154
|
+
command.option('--region <region>', texts_1.OPTION_REST_API_REGION);
|
|
155
|
+
command.option('-w, --workspace <domain>', texts_1.DESC_COMMAND_API_WORKSPACE);
|
|
156
|
+
command.option('-p, --project <name>', texts_1.DESC_COMMAND_API_PROJECT);
|
|
157
|
+
command.option('-q, --query <key:val...>', texts_1.DESC_COMMAND_API_REQUEST_QUERY);
|
|
158
|
+
command.option('-o, --output <filepath>', texts_1.DESC_COMMAND_API_OUTPUT);
|
|
159
|
+
if (allowBody) {
|
|
160
|
+
command.option('-d, --data <key:val...>', texts_1.DESC_COMMAND_API_DATA);
|
|
161
|
+
command.option('-j, --json <json>', texts_1.DESC_COMMAND_API_JSON);
|
|
162
|
+
command.option('-f, --form <key:val...>', texts_1.DESC_COMMAND_API_FORM);
|
|
163
|
+
}
|
|
164
|
+
command.argument('<url>', texts_1.DESC_COMMAND_API_REQUEST_URL);
|
|
165
|
+
command.action(async (url, options) => {
|
|
166
|
+
await request(method, url, options);
|
|
167
|
+
});
|
|
168
|
+
return command;
|
|
169
|
+
};
|
|
170
|
+
exports.default = newApiRequestCommand;
|
|
@@ -7,7 +7,17 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
const texts_1 = require("../texts");
|
|
8
8
|
const list_1 = __importDefault(require("./api/list"));
|
|
9
9
|
const info_1 = __importDefault(require("./api/info"));
|
|
10
|
+
const post_1 = __importDefault(require("./api/post"));
|
|
11
|
+
const put_1 = __importDefault(require("./api/put"));
|
|
12
|
+
const patch_1 = __importDefault(require("./api/patch"));
|
|
13
|
+
const get_1 = __importDefault(require("./api/get"));
|
|
14
|
+
const delete_1 = __importDefault(require("./api/delete"));
|
|
10
15
|
const commandApi = (0, utils_1.newCommand)('api', texts_1.DESC_COMMAND_API);
|
|
11
16
|
commandApi.addCommand(list_1.default);
|
|
12
17
|
commandApi.addCommand(info_1.default);
|
|
18
|
+
commandApi.addCommand(post_1.default);
|
|
19
|
+
commandApi.addCommand(put_1.default);
|
|
20
|
+
commandApi.addCommand(patch_1.default);
|
|
21
|
+
commandApi.addCommand(get_1.default);
|
|
22
|
+
commandApi.addCommand(delete_1.default);
|
|
13
23
|
exports.default = commandApi;
|
|
@@ -14,7 +14,25 @@ const input_1 = __importDefault(require("../input"));
|
|
|
14
14
|
const OAUTH_CLIENT_APP_PORT = 7596;
|
|
15
15
|
const OAUTH_CLIENT_APP_HOST = 'localhost';
|
|
16
16
|
const OAUTH_CLIENT_APP_REDIRECT_URL = `http://localhost:${OAUTH_CLIENT_APP_PORT}`;
|
|
17
|
-
const OAUTH_CLIENT_APP_SCOPES =
|
|
17
|
+
const OAUTH_CLIENT_APP_SCOPES = [
|
|
18
|
+
'WORKSPACE',
|
|
19
|
+
'MEMBER_EMAIL',
|
|
20
|
+
'REPOSITORY_WRITE',
|
|
21
|
+
'EXECUTION_MANAGE',
|
|
22
|
+
'ENVIRONMENT_MANAGE',
|
|
23
|
+
'TARGET_MANAGE',
|
|
24
|
+
'ZONE_MANAGE',
|
|
25
|
+
'WEBHOOK_MANAGE',
|
|
26
|
+
'VARIABLE_MANAGE',
|
|
27
|
+
'USER_EMAIL',
|
|
28
|
+
'USER_KEY',
|
|
29
|
+
'USER_INFO',
|
|
30
|
+
'INTEGRATION_MANAGE',
|
|
31
|
+
'SANDBOX_MANAGE',
|
|
32
|
+
'PACKAGE_MANAGE',
|
|
33
|
+
'TUNNEL_MANAGE',
|
|
34
|
+
'UNIT_TEST_MANAGE'
|
|
35
|
+
];
|
|
18
36
|
function normalizeBaseUrl(url) {
|
|
19
37
|
let normalized = url.trim();
|
|
20
38
|
normalized = normalized.replace(/^https?:\/\//i, '');
|
|
@@ -79,7 +97,7 @@ async function oauthServer(api, clientId, clientSecret) {
|
|
|
79
97
|
reject(texts_1.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN);
|
|
80
98
|
});
|
|
81
99
|
s.listen(OAUTH_CLIENT_APP_PORT, OAUTH_CLIENT_APP_HOST);
|
|
82
|
-
const url = `https://${api}/oauth2/authorize?type=web_server&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(OAUTH_CLIENT_APP_REDIRECT_URL)}&response_type=code&scope=${encodeURIComponent(OAUTH_CLIENT_APP_SCOPES)}`;
|
|
100
|
+
const url = `https://${api}/oauth2/authorize?type=web_server&client_id=${encodeURIComponent(clientId)}&redirect_uri=${encodeURIComponent(OAUTH_CLIENT_APP_REDIRECT_URL)}&response_type=code&scope=${encodeURIComponent(OAUTH_CLIENT_APP_SCOPES.join(' '))}`;
|
|
83
101
|
(0, open_1.default)(url);
|
|
84
102
|
});
|
|
85
103
|
}
|
package/distTs/src/input.js
CHANGED
|
@@ -470,13 +470,15 @@ class Input {
|
|
|
470
470
|
}
|
|
471
471
|
return p;
|
|
472
472
|
}
|
|
473
|
-
static restApiWorkspace(workspace) {
|
|
473
|
+
static restApiWorkspace(workspace, allowNull) {
|
|
474
474
|
let w = process.env.BUDDY_WORKSPACE;
|
|
475
475
|
if (workspace)
|
|
476
476
|
w = workspace;
|
|
477
477
|
if (!w)
|
|
478
478
|
w = cfg_1.default.getWorkspace();
|
|
479
479
|
if (!w) {
|
|
480
|
+
if (allowNull)
|
|
481
|
+
return null;
|
|
480
482
|
output_1.default.exitError(texts_1.ERR_REST_API_WORKSPACE);
|
|
481
483
|
}
|
|
482
484
|
return w;
|
package/distTs/src/texts.js
CHANGED
|
@@ -10,9 +10,9 @@ exports.LOG_TUNNEL_REGISTERED = exports.LOG_ERROR_WHILE_REFRESHING_AGENT = expor
|
|
|
10
10
|
exports.DESC_COMMAND_SANDBOX_LIST = exports.DESC_COMMAND_SANDBOX_CREATE = exports.DESC_COMMAND_SANDBOX = exports.DEBUG_WAIT_FOR_IDLE_TIMEOUT = exports.DEBUG_WAIT_FOR_IDLE = exports.DEBUG_RESOURCE_DISCOVERY_TIMEOUT = exports.DEBUG_AUTO_WIDTH = exports.DEBUG_AUTO_SCROLL = exports.DEBUG_RESOURCE_SCRAPPING_URL = exports.DEBUG_SNAPSHOT_PROCESSING = exports.DEBUG_SNAPSHOTS_PROCESSING = exports.DEBUG_EXEC_COMMAND = exports.DEBUG_EXEC_TEST_COMMAND = exports.LOG_INSTALLED_BROWSER = exports.LOG_SESSION_LINK = exports.LOG_SENDING_DATA = exports.LOG_SENDING_REQUEST = exports.LOG_PROCESSING_SNAPSHOTS = exports.LOG_RUNNING_EXEC_COMMAND = exports.LOG_TUNNEL_SSH_STREAM = exports.LOG_TUNNEL_TLS_AGENT_STREAM = exports.LOG_TUNNEL_TLS_REGION_STREAM = exports.LOG_TUNNEL_TLS_TARGET_STREAM = exports.LOG_TUNNEL_HTTP2_STREAM = exports.LOG_TUNNEL_HTTP1_STREAM = exports.LOG_TUNNEL_TCP_STREAM = exports.LOG_TUNNEL_HTTP_WRONG_USER_AGENTS = exports.LOG_TUNNEL_HTTP_CIRCUIT_BREAKER_OPEN = exports.LOG_TUNNEL_HTTP_RATE_LIMIT = exports.LOG_TUNNEL_HTTP_WRON_AUTH = exports.LOG_TUNNEL_IDENTIFIED = exports.LOG_TUNNEL_DISCONNECTED = exports.LOG_TUNNEL_FAILED = exports.LOG_TUNNEL_CONNECTED = exports.LOG_AGENT_STARTED = exports.LOG_AGENT_SERVER_STARTED = exports.LOG_ERROR_STARTING_AGENT_SERVER = exports.LOG_SSH_CONNECTION = exports.LOG_WRONG_STREAM = exports.LOG_DETECTED_STREAM = exports.LOG_HTTP2_REQUEST = exports.LOG_HTTP2_CONNECTION = exports.LOG_HTTP1_REQUEST = exports.LOG_HTTP1_CONNECTION = exports.LOG_ERROR = exports.LOG_STOPPING_TUNNEL = exports.LOG_STARTING_TUNNEL = exports.LOG_ENABLING_AGENT_TARGET = exports.LOG_DISABLING_AGENT_TARGET = exports.LOG_REMOVING_TUNNEL = void 0;
|
|
11
11
|
exports.DESC_COMMAND_SANDBOX_SNAPSHOT_CREATE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_LIST = exports.DESC_COMMAND_SANDBOX_SNAPSHOT = exports.TXT_SANDBOX_COMMAND_KILLED = exports.OPTION_SANDBOX_COMMAND_KILL_CONFIRM = exports.OPTION_SANDBOX_COMMAND_ID = exports.DESC_COMMAND_SANDBOX_EXEC_KILL = exports.DESC_COMMAND_SANDBOX_EXEC_LOGS = exports.DESC_COMMAND_SANDBOX_EXEC_STATUS = exports.DESC_COMMAND_SANDBOX_EXEC_LIST = exports.TXT_SANDBOX_WAITING_START = exports.TXT_SANDBOX_WAITING_STOP = exports.TXT_SANDBOX_WAITING_SETUP = exports.TXT_SANDBOX_WAITING_RUNNING = exports.TXT_SANDBOX_STOPPED = exports.TXT_SANDBOX_STARTED = exports.TXT_SANDBOX_DESTROYED = exports.TXT_SANDBOX_DESTROY_CONFIRM = exports.TXT_SANDBOX_CREATED = exports.TXT_SANDBOX_CREATING = exports.OPTION_SANDBOX_WAIT = exports.OPTION_SANDBOX_WAIT_CONFIGURED = exports.OPTION_SANDBOX_WAIT_RUNNING = exports.ERR_SANDBOX_STOP_FAILED = exports.ERR_SANDBOX_NO_COMMANDS = exports.ERR_SANDBOX_RUNNING_FAILED = exports.ERR_SANDBOX_STOP_TIMEOUT = exports.ERR_SANDBOX_SNAPSHOT_TIMEOUT = exports.ERR_SANDBOX_RUNNING_TIMEOUT = exports.ERR_SANDBOX_SETUP_TIMEOUT = exports.ERR_SANDBOX_SETUP_FAILED = exports.ERR_SANDBOX_INVALID_RESOURCES = exports.ERR_SANDBOX_NOT_FOUND = exports.OPTION_SANDBOX_RUNTIME = exports.OPTION_SANDBOX_APP_TYPE = exports.OPTION_SANDBOX_APP_DIR = exports.OPTION_SANDBOX_RUN_COMMAND = exports.OPTION_SANDBOX_TAGS = exports.OPTION_SANDBOX_INSTALL_COMMANDS = exports.OPTION_SANDBOX_RESOURCES = exports.OPTION_SANDBOX_OS = exports.OPTION_SANDBOX_NAME = exports.OPTION_SANDBOX_IDENTIFIER = exports.DESC_COMMAND_SANDBOX_EXEC = exports.DESC_COMMAND_SANDBOX_STATUS = exports.DESC_COMMAND_SANDBOX_RESTART = exports.DESC_COMMAND_SANDBOX_STOP = exports.DESC_COMMAND_SANDBOX_START = exports.DESC_COMMAND_SANDBOX_DESTROY = exports.DESC_COMMAND_SANDBOX_GET = void 0;
|
|
12
12
|
exports.TXT_SANDBOX_EXEC_BACKGROUND = exports.TXT_SANDBOX_EXEC_ID = exports.ERR_SANDBOX_CP_INVALID_SOURCE = exports.ERR_SANDBOX_CP_INVALID_DEST = exports.ERR_SANDBOX_CP_REPLACE = exports.ERR_SANDBOX_CP_MKDIR = exports.ERR_SANDBOX_CP_PATH_EXISTS = exports.ERR_SANDBOX_CP_NOT_EMPTY_DIR = exports.ERR_SANDBOX_CP_READDIR = exports.ERR_SANDBOX_CP_DEST_NOT_FOLDER = exports.ERR_SANDBOX_CP_SOURCE_NOT_FOUND = exports.TXT_SANDBOX_CP_DONE = exports.TXT_SANDBOX_CP_PROGRESS = exports.TXT_SANDBOX_UNZIPPING_COUNT = exports.TXT_SANDBOX_UNZIP_DONE = exports.TXT_SANDBOX_UNZIP = exports.TXT_SANDBOX_CP_DOWNLOAD_DONE = exports.TXT_SANDBOX_CP_DOWNLOAD = exports.OPTION_SANDBOX_CP_DOWNLOAD_REPLACE = exports.OPTION_SANDBOX_CP_DOWNLOAD_MERGE = exports.OPTION_SANDBOX_CP_DEST = exports.OPTION_SANDBOX_CP_SOURCE = exports.DESC_COMMAND_SANDBOX_CP = exports.ERR_SANDBOX_ENDPOINTS_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_NOT_FOUND = exports.ERR_SANDBOX_ENDPOINT_EXISTS = exports.TXT_SANDBOX_ENDPOINT_DELETED = exports.TXT_SANDBOX_ENDPOINT_DELETE_CONFIRM = exports.TXT_SANDBOX_ENDPOINT_ADDED = exports.OPTION_SANDBOX_ENDPOINT_TYPE = exports.OPTION_SANDBOX_ENDPOINT_PORT = exports.OPTION_SANDBOX_ENDPOINT_NAME_ARG = exports.OPTION_SANDBOX_ENDPOINT_NAME = exports.DESC_COMMAND_SANDBOX_ENDPOINT_DELETE = exports.DESC_COMMAND_SANDBOX_ENDPOINT_ADD = exports.DESC_COMMAND_SANDBOX_ENDPOINT_GET = exports.DESC_COMMAND_SANDBOX_ENDPOINT_LIST = exports.DESC_COMMAND_SANDBOX_ENDPOINT = exports.ERR_SANDBOX_SNAPSHOTS_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_NOT_FOUND = exports.ERR_SANDBOX_SNAPSHOT_FAILED = exports.TXT_SANDBOX_SNAPSHOT_WAITING = exports.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM = exports.TXT_SANDBOX_SNAPSHOT_DELETED = exports.TXT_SANDBOX_SNAPSHOT_CREATED = exports.OPTION_SANDBOX_FROM_SNAPSHOT = exports.OPTION_SANDBOX_SNAPSHOT_NAME_ARG = exports.OPTION_SANDBOX_SNAPSHOT_NAME = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_DELETE = exports.DESC_COMMAND_SANDBOX_SNAPSHOT_GET = void 0;
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.EXAMPLE_PACKAGE_VERSION_DELETE = exports.EXAMPLE_PACKAGE_VERSION_GET = exports.EXAMPLE_PACKAGE_VERSION_LIST = exports.EXAMPLE_PACKAGE_CREATE = exports.EXAMPLE_PACKAGE_DELETE = exports.EXAMPLE_PACKAGE_DOWNLOAD = exports.EXAMPLE_PACKAGE_PUBLISH = exports.EXAMPLE_PIPELINE_RUN = void 0;
|
|
13
|
+
exports.TXT_LOGIN_ENTER_BASE_URL = exports.TXT_LOGIN_SELECT_REGION = exports.TXT_WORKSPACE_NONE = exports.TXT_WORKSPACE_SET_SUCCESS = exports.ARG_COMMAND_WORKSPACE = exports.DESC_COMMAND_WORKSPACE_GET = exports.DESC_COMMAND_WORKSPACE_SET = exports.DESC_COMMAND_WORKSPACE_LIST = exports.DESC_COMMAND_WORKSPACE = exports.TXT_LOGOUT_SUCCESS = exports.DESC_COMMAND_LOGOUT = exports.DESC_COMMAND_LOGIN = exports.ERR_API_MEDIA_TYPE_NOT_IMPLEMENTED = exports.ERR_API_PARAMETER_NOT_REPLACED = exports.TXT_API_ENDPOINT_REQUIRED_SCOPES = exports.ERR_API_ENDPOINT_NOT_FOUND = exports.ERR_API_WRONG_METHOD = exports.ERR_SCHEMA_FETCH_FAILED = exports.OPT_COMMAND_API_INFO_URL = exports.OPT_COMMAND_API_INFO_METHOD = exports.OPT_COMMAND_API_LIST_SEARCH = exports.OPT_COMMAND_API_LIST_METHOD = exports.ERR_API_REQUEST_BODY_VALUE = exports.ERR_API_REQUEST_QUERY_VALUE = exports.ERR_API_REQUEST_INVALID_JSON = exports.ERR_API_REQUEST_FILE_ERROR = exports.ERR_API_REQUEST_OUTPUT_EXISTS = exports.DESC_COMMAND_API_INFO = exports.DESC_COMMAND_API_FORM = exports.DESC_COMMAND_API_JSON = exports.DESC_COMMAND_API_DATA = exports.DESC_COMMAND_API_OUTPUT = exports.DESC_COMMAND_API_REQUEST_QUERY = exports.DESC_COMMAND_API_PROJECT = exports.DESC_COMMAND_API_WORKSPACE = exports.DESC_COMMAND_API_REQUEST_URL = exports.DESC_COMMAND_API_GET = exports.DESC_COMMAND_API_PATCH = exports.DESC_COMMAND_API_DELETE = exports.DESC_COMMAND_API_PUT = exports.DESC_COMMAND_API_POST = exports.DESC_COMMAND_API_LIST = exports.DESC_COMMAND_API = exports.ERR_WHOAMI_LOGOUT = exports.TXT_WHOAMI_NO_PROJECT = exports.TXT_WHOAMI_NO_WORKSPACE = exports.DESC_COMMAND_WHOAMI = exports.TXT_SANDBOX_EXEC_FAILED = exports.TXT_SANDBOX_EXEC_INPROGRESS = exports.TXT_SANDBOX_EXEC_SUCCESS = void 0;
|
|
14
|
+
exports.EXAMPLE_AGENT_TUNNEL_LIST = exports.EXAMPLE_TUNNEL_HTTP = exports.EXAMPLE_SANDBOX_CREATE = exports.EXAMPLE_SANDBOX_CP = exports.TXT_PROJECT_NONE = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_PROJECT_SET_CLEARED = exports.TXT_PROJECT_SET_SUCCESS = exports.DESC_COMMAND_PROJECT_GET = exports.ARG_COMMAND_PROJECT_NAME = exports.DESC_COMMAND_PROJECT_SET = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT = exports.TXT_PACKAGE_VERSION_DOWNLOAD = exports.TXT_PACKAGE_PUBLISH = exports.TXT_PACKAGE_CREATED = exports.TXT_PACKAGE_VERSION_DELETED = exports.TXT_PACKAGE_DELETED = exports.ERR_COMMAND_PACKAGE_TYPE = exports.OPT_COMMAND_PACKAGE_VERSION = exports.OPT_COMMAND_PACKAGE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_CREATE_IDENTIFIER = exports.OPT_COMMAND_PACKAGE_NAME = exports.OPT_COMMAND_PACKAGE_TYPE = exports.DESC_COMMAND_PACKAGE_CREATE = exports.DESC_COMMAND_PACKAGE_GET = exports.TXT_PACKAGE_DOCKER_LOGIN_FAILED = exports.TXT_PACKAGE_DOCKER_LOGIN_SUCCESS = exports.TXT_PACKAGE_VERSION_DELETE_CONFIRM = exports.TXT_PACKAGE_DELETE_CONFIRM = exports.DESC_COMMAND_PACKAGE_DELETE = exports.ERR_COMMAND_PACKAGE_NO_PROJECTS = exports.DESC_COMMAND_PACKAGE_VERSION_GET = exports.DESC_COMMAND_PACKAGE_VERSION_LIST = exports.DESC_COMMAND_PACKAGE_VERSION_DELETE = exports.DESC_COMMAND_PACKAGE_DOCKER_LOGIN = exports.DESC_COMMAND_PACKAGE_LIST = exports.DESC_COMMAND_PACKAGE_VERSION = exports.ERR_API_MESSAGE_REPLACER = exports.ERR_LOGIN_INVALID_BASE_URL = exports.ERR_LOGIN_NO_PROJECT_FOUND = exports.ERR_LOGIN_NO_WORKSPACE_FOUND = exports.ERR_LOGIN_NO_WORKSPACES = exports.ERR_LOGIN_HTTP_SUCCESS = exports.ERR_LOGIN_HTTP_FAILED = exports.TXT_LOGIN_OAUTH = exports.ERR_LOGIN_HTTP_SERVER_PORT_TAKEN = exports.TXT_LOGIN_SUCCESS = exports.TXT_LOGIN_SELECT_WORKSPACE = void 0;
|
|
15
|
+
exports.EXAMPLE_PACKAGE_VERSION_DELETE = exports.EXAMPLE_PACKAGE_VERSION_GET = exports.EXAMPLE_PACKAGE_VERSION_LIST = exports.EXAMPLE_PACKAGE_CREATE = exports.EXAMPLE_PACKAGE_DELETE = exports.EXAMPLE_PACKAGE_DOWNLOAD = exports.EXAMPLE_PACKAGE_PUBLISH = exports.EXAMPLE_PIPELINE_RUN = exports.EXAMPLE_SANDBOX_ENDPOINT_LIST = exports.EXAMPLE_SANDBOX_ENDPOINT_GET = exports.EXAMPLE_SANDBOX_ENDPOINT_DELETE = exports.EXAMPLE_SANDBOX_ENDPOINT_CREATE = exports.EXAMPLE_SANDBOX_SNAPSHOT_LIST = exports.EXAMPLE_SANDBOX_SNAPSHOT_GET = exports.EXAMPLE_SANDBOX_SNAPSHOT_DELETE = exports.EXAMPLE_SANDBOX_SNAPSHOT_CREATE = exports.EXAMPLE_SANDBOX_EXEC_STATUS = exports.EXAMPLE_SANDBOX_EXEC_LOGS = exports.EXAMPLE_SANDBOX_EXEC_LIST = exports.EXAMPLE_SANDBOX_EXEC_KILL = exports.EXAMPLE_SANDBOX_EXEC_COMMAND = exports.EXAMPLE_TUNNEL_START = exports.EXAMPLE_TUNNEL_TCP = exports.EXAMPLE_TUNNEL_TLS = exports.EXAMPLE_AGENT_TUNNEL_START = exports.EXAMPLE_AGENT_TUNNEL_STATUS = exports.EXAMPLE_AGENT_TUNNEL_REMOVE = void 0;
|
|
16
16
|
const utils_1 = require("./utils");
|
|
17
17
|
exports.ERR_REST_API_GENERAL_ERROR = 'Something went wrong';
|
|
18
18
|
exports.ERR_REST_API_NOT_RESPONDING = 'Api endpoint not responding. Try again later...';
|
|
@@ -654,7 +654,27 @@ exports.ERR_WHOAMI_LOGOUT = 'Not logged in. Run `bdy login` to authenticate.';
|
|
|
654
654
|
// api command
|
|
655
655
|
exports.DESC_COMMAND_API = 'Contact Buddy API directly';
|
|
656
656
|
exports.DESC_COMMAND_API_LIST = 'List Buddy API endpoints';
|
|
657
|
+
exports.DESC_COMMAND_API_POST = 'Make HTTP POST to Buddy API endpoint';
|
|
658
|
+
exports.DESC_COMMAND_API_PUT = 'Make HTTP PUT to Buddy API endpoint';
|
|
659
|
+
exports.DESC_COMMAND_API_DELETE = 'Make HTTP DELETE to Buddy API endpoint';
|
|
660
|
+
exports.DESC_COMMAND_API_PATCH = 'Make HTTP PATCH to Buddy API endpoint';
|
|
661
|
+
exports.DESC_COMMAND_API_GET = 'Make HTTP GET to Buddy API endpoint';
|
|
662
|
+
exports.DESC_COMMAND_API_REQUEST_URL = 'Request url';
|
|
663
|
+
exports.DESC_COMMAND_API_WORKSPACE = 'Workspace domain. If url contains {workspace_domain} it will be automatically replaced with provided value.';
|
|
664
|
+
exports.DESC_COMMAND_API_PROJECT = 'Project name. If url contains {project_name} it will be automatically replaced with provided value.';
|
|
665
|
+
exports.DESC_COMMAND_API_REQUEST_QUERY = 'Provide query param as key:value. Can be used multiple times';
|
|
666
|
+
exports.DESC_COMMAND_API_OUTPUT = 'Write to file instead of stdout';
|
|
667
|
+
exports.DESC_COMMAND_API_DATA = 'HTTP request urlencoded data. To specify file use @path/to/file format in value';
|
|
668
|
+
exports.DESC_COMMAND_API_JSON = 'HTTP request json data. To specify file containing json use @path/to/file format in value';
|
|
669
|
+
exports.DESC_COMMAND_API_FORM = 'HTTP request multipart data. Can be used multiple times. To specify file use @path/to/file format in value';
|
|
657
670
|
exports.DESC_COMMAND_API_INFO = 'Show info about API endpoint';
|
|
671
|
+
exports.ERR_API_REQUEST_OUTPUT_EXISTS = 'Output path already exists';
|
|
672
|
+
exports.ERR_API_REQUEST_FILE_ERROR = 'Cannot read provided file';
|
|
673
|
+
exports.ERR_API_REQUEST_INVALID_JSON = 'JSON data is invalid';
|
|
674
|
+
const ERR_API_REQUEST_QUERY_VALUE = (q) => `Wrong value of query param: ${q}`;
|
|
675
|
+
exports.ERR_API_REQUEST_QUERY_VALUE = ERR_API_REQUEST_QUERY_VALUE;
|
|
676
|
+
const ERR_API_REQUEST_BODY_VALUE = (p) => `Wrong value of body param ${p}`;
|
|
677
|
+
exports.ERR_API_REQUEST_BODY_VALUE = ERR_API_REQUEST_BODY_VALUE;
|
|
658
678
|
exports.OPT_COMMAND_API_LIST_METHOD = 'Filter endpoints by method (all, get, post, put, patch, delete). Default: all';
|
|
659
679
|
exports.OPT_COMMAND_API_LIST_SEARCH = 'Filter endpoints by phrase';
|
|
660
680
|
exports.OPT_COMMAND_API_INFO_METHOD = 'Endpoint method (get, post, put, patch, delete)';
|
|
@@ -663,6 +683,8 @@ exports.ERR_SCHEMA_FETCH_FAILED = 'Failed to fetch api schema';
|
|
|
663
683
|
exports.ERR_API_WRONG_METHOD = 'Wrong method value';
|
|
664
684
|
exports.ERR_API_ENDPOINT_NOT_FOUND = 'Endpoint not found';
|
|
665
685
|
exports.TXT_API_ENDPOINT_REQUIRED_SCOPES = 'Required scopes';
|
|
686
|
+
const ERR_API_PARAMETER_NOT_REPLACED = (param) => `Replace URL parameter ${param}`;
|
|
687
|
+
exports.ERR_API_PARAMETER_NOT_REPLACED = ERR_API_PARAMETER_NOT_REPLACED;
|
|
666
688
|
const ERR_API_MEDIA_TYPE_NOT_IMPLEMENTED = (type) => `Media type not implemented (${type})`;
|
|
667
689
|
exports.ERR_API_MEDIA_TYPE_NOT_IMPLEMENTED = ERR_API_MEDIA_TYPE_NOT_IMPLEMENTED;
|
|
668
690
|
// Login command
|