bdy 1.17.27-dev → 1.17.29-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 +7 -0
- package/distTs/src/command/project/link.js +88 -22
- package/distTs/src/command/sandbox/cp.js +7 -11
- package/distTs/src/command/sandbox/destroy.js +3 -5
- package/distTs/src/command/sandbox/endpoint/add.js +4 -6
- package/distTs/src/command/sandbox/endpoint/delete.js +4 -6
- package/distTs/src/command/sandbox/endpoint/get.js +3 -5
- package/distTs/src/command/sandbox/endpoint/list.js +3 -5
- package/distTs/src/command/sandbox/exec/command.js +5 -7
- package/distTs/src/command/sandbox/exec/kill.js +3 -5
- package/distTs/src/command/sandbox/exec/list.js +3 -5
- package/distTs/src/command/sandbox/exec/logs.js +4 -6
- package/distTs/src/command/sandbox/exec/status.js +3 -5
- package/distTs/src/command/sandbox/get.js +3 -5
- package/distTs/src/command/sandbox/restart.js +4 -6
- package/distTs/src/command/sandbox/snapshot/create.js +4 -6
- package/distTs/src/command/sandbox/snapshot/delete.js +4 -6
- package/distTs/src/command/sandbox/snapshot/get.js +4 -6
- package/distTs/src/command/sandbox/snapshot/list.js +3 -5
- package/distTs/src/command/sandbox/start.js +4 -6
- package/distTs/src/command/sandbox/status.js +3 -5
- package/distTs/src/command/sandbox/stop.js +4 -6
- package/distTs/src/command/sandbox/update.js +5 -8
- package/distTs/src/command/sandbox/yaml.js +3 -6
- package/distTs/src/output.js +39 -2
- package/distTs/src/texts.js +17 -13
- package/package.json +1 -1
package/distTs/package.json
CHANGED
package/distTs/src/api/client.js
CHANGED
|
@@ -623,6 +623,13 @@ class ApiClient {
|
|
|
623
623
|
opts.package_version = version;
|
|
624
624
|
return await this.getResourceByIdentifier(workspace, opts);
|
|
625
625
|
}
|
|
626
|
+
async getSandboxByIdentifier(workspace, project, sandbox) {
|
|
627
|
+
const opts = {
|
|
628
|
+
project,
|
|
629
|
+
sandbox
|
|
630
|
+
};
|
|
631
|
+
return await this.getResourceByIdentifier(workspace, opts);
|
|
632
|
+
}
|
|
626
633
|
async getPackageVersions(workspace, pkgId, page = 1, perPage = 10) {
|
|
627
634
|
return await this.request({
|
|
628
635
|
method: 'GET',
|
|
@@ -10,7 +10,6 @@ const output_1 = __importDefault(require("../../output"));
|
|
|
10
10
|
const cfg_1 = __importDefault(require("../../project/cfg"));
|
|
11
11
|
const node_path_1 = require("node:path");
|
|
12
12
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
|
-
const human_id_1 = __importDefault(require("human-id"));
|
|
14
13
|
const commandProjectLink = (0, utils_1.newCommand)('link', texts_1.DESC_COMMAND_PROJECT_LINK);
|
|
15
14
|
commandProjectLink.option('-w, --workspace <domain>', texts_1.OPTION_REST_API_WORKSPACE);
|
|
16
15
|
commandProjectLink.option('-r, --relink', texts_1.OPT_COMMAND_PROJECT_LINK_RELINK);
|
|
@@ -20,10 +19,14 @@ commandProjectLink.argument('[directory]', texts_1.OPT_COMMAND_PROJECT_LINK_DIRE
|
|
|
20
19
|
commandProjectLink.action(async (dir, options) => {
|
|
21
20
|
output_1.default.handleSignals();
|
|
22
21
|
const { path, git } = await checkPath(dir, options);
|
|
23
|
-
const { workspace, project } = await createOrGetProject(options);
|
|
22
|
+
const { workspace, project, url } = await createOrGetProject(path, options);
|
|
24
23
|
cfg_1.default.init(path, workspace, project);
|
|
24
|
+
output_1.default.okSign();
|
|
25
|
+
output_1.default.normal(texts_1.TXT_COMMAND_PROJECT_LINK_TO, false);
|
|
26
|
+
output_1.default.light(` ${url}`);
|
|
25
27
|
await initRepo(workspace, project, path, git, options);
|
|
26
|
-
|
|
28
|
+
tryNow();
|
|
29
|
+
output_1.default.exitNormal();
|
|
27
30
|
});
|
|
28
31
|
const getProjectRemote = (data) => {
|
|
29
32
|
if (!data.integration) {
|
|
@@ -47,6 +50,19 @@ const getRemoteNames = (str) => {
|
|
|
47
50
|
});
|
|
48
51
|
return names;
|
|
49
52
|
};
|
|
53
|
+
const tryNow = () => {
|
|
54
|
+
output_1.default.cyan('→ ', false);
|
|
55
|
+
output_1.default.label(texts_1.OPT_COMMAND_PROJECT_LINK_TRY_NOW);
|
|
56
|
+
output_1.default.dim('$ ', false);
|
|
57
|
+
output_1.default.light('bdy tunnel http 3000 ', false);
|
|
58
|
+
output_1.default.muted(' Expose localhost:3000 to the internet');
|
|
59
|
+
output_1.default.dim('$ ', false);
|
|
60
|
+
output_1.default.light('bdy package publish . ', false);
|
|
61
|
+
output_1.default.muted(' Publish a package from the current project');
|
|
62
|
+
output_1.default.dim('$ ', false);
|
|
63
|
+
output_1.default.light('bdy sandbox create --run "npm start" ', false);
|
|
64
|
+
output_1.default.muted(' Spin up a cloud sandbox and run your app');
|
|
65
|
+
};
|
|
50
66
|
const initRepo = async (workspace, project, path, git, options) => {
|
|
51
67
|
const client = input_1.default.restApiTokenClient();
|
|
52
68
|
const data = await client.getProject(workspace, project);
|
|
@@ -60,6 +76,8 @@ const initRepo = async (workspace, project, path, git, options) => {
|
|
|
60
76
|
await (0, utils_1.execLocally)('git init', {
|
|
61
77
|
cwd: path,
|
|
62
78
|
});
|
|
79
|
+
output_1.default.okSign();
|
|
80
|
+
output_1.default.normal(texts_1.TXT_COMMAND_PROJECT_LINK_GIT_REPO_INITIALIZED);
|
|
63
81
|
}
|
|
64
82
|
const str = await (0, utils_1.execLocally)('git remote -v', {
|
|
65
83
|
cwd: path,
|
|
@@ -69,17 +87,36 @@ const initRepo = async (workspace, project, path, git, options) => {
|
|
|
69
87
|
await (0, utils_1.execLocally)(`git remote add origin ${remote}`, {
|
|
70
88
|
cwd: path,
|
|
71
89
|
});
|
|
90
|
+
output_1.default.okSign();
|
|
91
|
+
output_1.default.normal('Remote ', false);
|
|
92
|
+
output_1.default.light('origin ', false);
|
|
93
|
+
output_1.default.normal('set to ', false);
|
|
94
|
+
output_1.default.light(remote);
|
|
72
95
|
}
|
|
73
96
|
else if (remotes.origin !== remote) {
|
|
74
|
-
output_1.default.
|
|
75
|
-
output_1.default.normal(
|
|
76
|
-
output_1.default.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
97
|
+
output_1.default.yellow(texts_1.OPT_COMMAND_PROJECT_LINK_HAS_REMOTE);
|
|
98
|
+
output_1.default.normal('Current origin: ', false);
|
|
99
|
+
output_1.default.light(remotes.origin);
|
|
100
|
+
output_1.default.normal('Buddy project: ', false);
|
|
101
|
+
output_1.default.light(remote);
|
|
102
|
+
const opt = await output_1.default.inputMenuAdv(texts_1.OPT_COMMAND_PROJECT_LINK_SET_GIT_REMOTE, [
|
|
103
|
+
{
|
|
104
|
+
name: 'Add buddy remote',
|
|
105
|
+
description: "Keep origin, add as 'buddy' remote",
|
|
106
|
+
value: 'buddy',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'Replace origin',
|
|
110
|
+
description: "Replace current origin with Buddy's project remote",
|
|
111
|
+
value: 'origin',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'Skip',
|
|
115
|
+
description: "Don't change git remotes",
|
|
116
|
+
value: 'skip',
|
|
117
|
+
},
|
|
81
118
|
]);
|
|
82
|
-
if (
|
|
119
|
+
if (opt === 'buddy') {
|
|
83
120
|
if (remotes.buddy) {
|
|
84
121
|
await (0, utils_1.execLocally)(`git remote rm buddy`, {
|
|
85
122
|
cwd: path,
|
|
@@ -88,17 +125,25 @@ const initRepo = async (workspace, project, path, git, options) => {
|
|
|
88
125
|
await (0, utils_1.execLocally)(`git remote add buddy ${remote}`, {
|
|
89
126
|
cwd: path,
|
|
90
127
|
});
|
|
128
|
+
output_1.default.okSign();
|
|
129
|
+
output_1.default.normal('Remote ', false);
|
|
130
|
+
output_1.default.light('buddy ', false);
|
|
131
|
+
output_1.default.normal('set to ', false);
|
|
132
|
+
output_1.default.light(remote);
|
|
91
133
|
}
|
|
92
|
-
else if (
|
|
134
|
+
else if (opt === 'origin') {
|
|
93
135
|
await (0, utils_1.execLocally)(`git remote rm origin`, {
|
|
94
136
|
cwd: path,
|
|
95
137
|
});
|
|
96
138
|
await (0, utils_1.execLocally)(`git remote add origin ${remote}`, {
|
|
97
139
|
cwd: path,
|
|
98
140
|
});
|
|
141
|
+
output_1.default.okSign();
|
|
142
|
+
output_1.default.normal('Origin replaced with ', false);
|
|
143
|
+
output_1.default.light(remote);
|
|
99
144
|
}
|
|
100
145
|
else {
|
|
101
|
-
|
|
146
|
+
return;
|
|
102
147
|
}
|
|
103
148
|
}
|
|
104
149
|
await (0, utils_1.execLocally)('git config --replace-all credential.helper ""', {
|
|
@@ -129,10 +174,11 @@ const checkPath = async (dir, options) => {
|
|
|
129
174
|
}
|
|
130
175
|
}
|
|
131
176
|
if (cfg_1.default.exists(path)) {
|
|
132
|
-
output_1.default.
|
|
177
|
+
output_1.default.yellow(texts_1.TXT_COMMAND_PROJECT_LINK_DIR_LINKED);
|
|
133
178
|
let relink = options.relink;
|
|
134
|
-
if (!relink)
|
|
179
|
+
if (!relink) {
|
|
135
180
|
relink = await output_1.default.confirm(texts_1.TXT_COMMAND_PROJECT_LINK_DIR_CONFIRM);
|
|
181
|
+
}
|
|
136
182
|
if (!relink)
|
|
137
183
|
output_1.default.exitNormal();
|
|
138
184
|
}
|
|
@@ -140,30 +186,49 @@ const checkPath = async (dir, options) => {
|
|
|
140
186
|
const git = !!children.find((name) => name === '.git');
|
|
141
187
|
return { path, git };
|
|
142
188
|
};
|
|
143
|
-
const createOrGetProject = async (options) => {
|
|
189
|
+
const createOrGetProject = async (path, options) => {
|
|
144
190
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
145
191
|
const client = input_1.default.restApiTokenClient();
|
|
146
192
|
let project = options.project;
|
|
193
|
+
let url;
|
|
147
194
|
if (project) {
|
|
148
195
|
try {
|
|
149
|
-
await client.getProject(workspace, project);
|
|
196
|
+
const response = await client.getProject(workspace, project);
|
|
197
|
+
url = String(response.html_url || '');
|
|
150
198
|
}
|
|
151
199
|
catch {
|
|
152
|
-
output_1.default.
|
|
200
|
+
output_1.default.yellow((0, texts_1.TXT_COMMAND_PROJECT_LINK_NOT_FOUND)(project));
|
|
153
201
|
const response = await client.createProject(workspace, {
|
|
154
202
|
display_name: project,
|
|
155
203
|
});
|
|
204
|
+
output_1.default.okSign();
|
|
205
|
+
output_1.default.normal(texts_1.TXT_COMMAND_PROJECT_CREATED);
|
|
156
206
|
project = String(response.name || '');
|
|
207
|
+
url = String(response.html_url || '');
|
|
157
208
|
}
|
|
158
209
|
}
|
|
159
210
|
else {
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
211
|
+
const opt = await output_1.default.inputMenuAdv(texts_1.TXT_COMMAND_PROJECT_LINK_SELECT_PROJECT, [
|
|
212
|
+
{
|
|
213
|
+
name: texts_1.TXT_COMMAND_PROJECT_LINK_CREATE_NEW,
|
|
214
|
+
description: texts_1.TXT_COMMAND_PROJECT_LINK_CREATE_NEW_DESC,
|
|
215
|
+
value: 'new',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: texts_1.TXT_COMMAND_PROJECT_LINK_EXISTING,
|
|
219
|
+
description: texts_1.TXT_COMMAND_PROJECT_LINK_EXISTING_DESC,
|
|
220
|
+
value: 'existing',
|
|
221
|
+
},
|
|
222
|
+
]);
|
|
223
|
+
if (opt === 'new') {
|
|
224
|
+
const name = await output_1.default.inputString(texts_1.TXT_COMMAND_PROJECT_LINK_NAME, (0, node_path_1.basename)(path));
|
|
163
225
|
const response = await client.createProject(workspace, {
|
|
164
226
|
display_name: name,
|
|
165
227
|
});
|
|
228
|
+
output_1.default.okSign();
|
|
229
|
+
output_1.default.normal(texts_1.TXT_COMMAND_PROJECT_CREATED);
|
|
166
230
|
project = String(response.name || '');
|
|
231
|
+
url = String(response.html_url || '');
|
|
167
232
|
}
|
|
168
233
|
else {
|
|
169
234
|
const response = await client.getProjects(workspace);
|
|
@@ -171,8 +236,9 @@ const createOrGetProject = async (options) => {
|
|
|
171
236
|
output_1.default.exitError(texts_1.ERR_PROJECT_NO_PROJECTS);
|
|
172
237
|
}
|
|
173
238
|
project = await output_1.default.selectProject(response.projects, false);
|
|
239
|
+
url = response.projects.find((px) => px.name === project)?.html_url || '';
|
|
174
240
|
}
|
|
175
241
|
}
|
|
176
|
-
return { project, workspace };
|
|
242
|
+
return { project, workspace, url };
|
|
177
243
|
};
|
|
178
244
|
exports.default = commandProjectLink;
|
|
@@ -57,10 +57,8 @@ commandSandboxCp.addHelpText('after', texts_1.EXAMPLE_SANDBOX_CP);
|
|
|
57
57
|
const upload = async (client, workspace, project, source, destination) => {
|
|
58
58
|
const { sourcePath, sourceStats } = input_1.default.restApiSandboxUploadSourcePath(source);
|
|
59
59
|
const { identifier, remotePath, isRemoteDir } = input_1.default.restApiSandboxUploadDestinationPath(destination);
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
63
|
-
if (!found) {
|
|
60
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
61
|
+
if (!sandbox_id) {
|
|
64
62
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
65
63
|
}
|
|
66
64
|
if (sourceStats.isFile()) {
|
|
@@ -68,7 +66,7 @@ const upload = async (client, workspace, project, source, destination) => {
|
|
|
68
66
|
const name = (0, path_1.basename)(sourcePath);
|
|
69
67
|
output_1.default.normal((0, texts_1.TXT_SANDBOX_CP_PROGRESS)(1, 1, name));
|
|
70
68
|
const remoteFile = isRemoteDir ? (0, path_1.join)(remotePath, name) : remotePath;
|
|
71
|
-
await client.sandboxUploadFile(workspace,
|
|
69
|
+
await client.sandboxUploadFile(workspace, sandbox_id, remoteFile, sourcePath);
|
|
72
70
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(1));
|
|
73
71
|
}
|
|
74
72
|
else if (sourceStats.isDirectory()) {
|
|
@@ -90,7 +88,7 @@ const upload = async (client, workspace, project, source, destination) => {
|
|
|
90
88
|
const remoteFile = (0, path_1.join)(baseRemoteDir, relativePath).replace(/\\/g, '/');
|
|
91
89
|
output_1.default.clearPreviousLine();
|
|
92
90
|
output_1.default.normal((0, texts_1.TXT_SANDBOX_CP_PROGRESS)(i + 1, files.length, relativePath));
|
|
93
|
-
await client.sandboxUploadFile(workspace,
|
|
91
|
+
await client.sandboxUploadFile(workspace, sandbox_id, remoteFile, localFile);
|
|
94
92
|
}
|
|
95
93
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_CP_DONE)(files.length));
|
|
96
94
|
}
|
|
@@ -101,14 +99,12 @@ const upload = async (client, workspace, project, source, destination) => {
|
|
|
101
99
|
const download = async (client, workspace, project, source, destination, merge, replace) => {
|
|
102
100
|
const { destPath, isDestPathDir } = input_1.default.restApiSandboxDownloadDestinationPath(destination, merge, replace);
|
|
103
101
|
const { sourcePath, identifier } = input_1.default.restApiSandboxDownloadSourcePath(source);
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
107
|
-
if (!found) {
|
|
102
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
103
|
+
if (!sandbox_id) {
|
|
108
104
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
109
105
|
}
|
|
110
106
|
output_1.default.normal(texts_1.TXT_SANDBOX_CP_DOWNLOAD, false);
|
|
111
|
-
const { body, headers } = await client.sandboxDownloadFile(workspace,
|
|
107
|
+
const { body, headers } = await client.sandboxDownloadFile(workspace, sandbox_id, sourcePath);
|
|
112
108
|
const isFile = headers['content-type'] === 'application/octet-stream';
|
|
113
109
|
const name = (0, path_1.basename)(sourcePath);
|
|
114
110
|
if (isFile) {
|
|
@@ -17,17 +17,15 @@ commandSandboxDestroy.action(async (identifier, options) => {
|
|
|
17
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
18
|
const project = input_1.default.restApiProject(options.project);
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
-
if (!found) {
|
|
20
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
21
|
+
if (!sandbox_id) {
|
|
24
22
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
23
|
}
|
|
26
24
|
const confirmed = options.force ||
|
|
27
25
|
(await output_1.default.confirm((0, texts_1.TXT_SANDBOX_DESTROY_CONFIRM)(identifier)));
|
|
28
26
|
if (!confirmed)
|
|
29
27
|
output_1.default.exitNormal();
|
|
30
|
-
await client.deleteSandbox(workspace,
|
|
28
|
+
await client.deleteSandbox(workspace, sandbox_id);
|
|
31
29
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_DESTROYED)(identifier));
|
|
32
30
|
});
|
|
33
31
|
exports.default = commandSandboxDestroy;
|
|
@@ -15,13 +15,11 @@ commandSandboxEndpointAdd.action(async (identifier, options) => {
|
|
|
15
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
16
|
const project = input_1.default.restApiProject(options.project);
|
|
17
17
|
const client = input_1.default.restApiTokenClient();
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
21
|
-
if (!found) {
|
|
18
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
19
|
+
if (!sandbox_id) {
|
|
22
20
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
23
21
|
}
|
|
24
|
-
const sandbox = await client.getSandbox(workspace,
|
|
22
|
+
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
25
23
|
const endpoints = sandbox.endpoints || [];
|
|
26
24
|
const existing = endpoints.find((ep) => ep.name === options.name);
|
|
27
25
|
if (existing) {
|
|
@@ -30,7 +28,7 @@ commandSandboxEndpointAdd.action(async (identifier, options) => {
|
|
|
30
28
|
const endpoint = input_1.default.prepareSandboxEndpoint(options);
|
|
31
29
|
logger_1.default.info(endpoint);
|
|
32
30
|
const updatedEndpoints = [...endpoints, endpoint];
|
|
33
|
-
const updatedSandbox = await client.updateSandbox(workspace,
|
|
31
|
+
const updatedSandbox = await client.updateSandbox(workspace, sandbox_id, {
|
|
34
32
|
endpoints: updatedEndpoints,
|
|
35
33
|
});
|
|
36
34
|
const addedEndpoint = (updatedSandbox.endpoints || []).find((ep) => ep.name === options.name);
|
|
@@ -19,13 +19,11 @@ commandSandboxEndpointDelete.action(async (identifier, endpointName, options) =>
|
|
|
19
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
20
|
const project = input_1.default.restApiProject(options.project);
|
|
21
21
|
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
25
|
-
if (!found) {
|
|
22
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
23
|
+
if (!sandbox_id) {
|
|
26
24
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
27
25
|
}
|
|
28
|
-
const sandbox = await client.getSandbox(workspace,
|
|
26
|
+
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
29
27
|
const endpoints = sandbox.endpoints || [];
|
|
30
28
|
const endpointIndex = endpoints.findIndex((ep) => ep.name === endpointName);
|
|
31
29
|
if (endpointIndex === -1) {
|
|
@@ -36,7 +34,7 @@ commandSandboxEndpointDelete.action(async (identifier, endpointName, options) =>
|
|
|
36
34
|
(await output_1.default.confirm((0, texts_1.TXT_SANDBOX_ENDPOINT_DELETE_CONFIRM)(identifier, endpointName)));
|
|
37
35
|
if (!confirmed)
|
|
38
36
|
output_1.default.exitNormal();
|
|
39
|
-
await client.updateSandbox(workspace,
|
|
37
|
+
await client.updateSandbox(workspace, sandbox_id, {
|
|
40
38
|
endpoints: updatedEndpoints,
|
|
41
39
|
});
|
|
42
40
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_ENDPOINT_DELETED)(endpointName));
|
|
@@ -17,13 +17,11 @@ commandSandboxEndpointGet.action(async (identifier, endpointName, options) => {
|
|
|
17
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
18
|
const project = input_1.default.restApiProject(options.project);
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
-
if (!found) {
|
|
20
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
21
|
+
if (!sandbox_id) {
|
|
24
22
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
23
|
}
|
|
26
|
-
const sandbox = await client.getSandbox(workspace,
|
|
24
|
+
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
27
25
|
const endpoints = sandbox.endpoints || [];
|
|
28
26
|
const endpoint = endpoints.find((ep) => ep.name === endpointName);
|
|
29
27
|
if (!endpoint) {
|
|
@@ -17,13 +17,11 @@ commandSandboxEndpointList.action(async (identifier, options) => {
|
|
|
17
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
18
|
const project = input_1.default.restApiProject(options.project);
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
-
if (!found) {
|
|
20
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
21
|
+
if (!sandbox_id) {
|
|
24
22
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
23
|
}
|
|
26
|
-
const sandbox = await client.getSandbox(workspace,
|
|
24
|
+
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
27
25
|
const endpoints = sandbox.endpoints || [];
|
|
28
26
|
if (endpoints.length === 0) {
|
|
29
27
|
output_1.default.exitError(texts_1.ERR_SANDBOX_ENDPOINTS_NOT_FOUND);
|
|
@@ -22,13 +22,11 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
|
22
22
|
const project = input_1.default.restApiProject(options.project);
|
|
23
23
|
const client = input_1.default.restApiTokenClient();
|
|
24
24
|
const runtime = input_1.default.restApiSandboxExecRuntime(options.runtime);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
28
|
-
if (!found) {
|
|
25
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
26
|
+
if (!sandbox_id) {
|
|
29
27
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
30
28
|
}
|
|
31
|
-
const cmdResult = await client.executeSandboxCommand(workspace,
|
|
29
|
+
const cmdResult = await client.executeSandboxCommand(workspace, sandbox_id, {
|
|
32
30
|
command,
|
|
33
31
|
runtime,
|
|
34
32
|
});
|
|
@@ -37,7 +35,7 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
|
37
35
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_BACKGROUND)(cmdResult.id));
|
|
38
36
|
}
|
|
39
37
|
else {
|
|
40
|
-
const body = await client.streamSandboxCommandLogs(workspace,
|
|
38
|
+
const body = await client.streamSandboxCommandLogs(workspace, sandbox_id, cmdResult.id);
|
|
41
39
|
body.on('data', (data) => {
|
|
42
40
|
if (data) {
|
|
43
41
|
try {
|
|
@@ -54,7 +52,7 @@ commandSandboxExecCommand.action(async (identifier, command, options) => {
|
|
|
54
52
|
}
|
|
55
53
|
});
|
|
56
54
|
body.on('close', async () => {
|
|
57
|
-
const cmdExit = await client.getSandboxCommand(workspace,
|
|
55
|
+
const cmdExit = await client.getSandboxCommand(workspace, sandbox_id, cmdResult.id);
|
|
58
56
|
if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
|
|
59
57
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(cmdResult.id));
|
|
60
58
|
}
|
|
@@ -18,17 +18,15 @@ commandSandboxExecKill.action(async (identifier, commandId, options) => {
|
|
|
18
18
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
19
19
|
const project = input_1.default.restApiProject(options.project);
|
|
20
20
|
const client = input_1.default.restApiTokenClient();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
24
|
-
if (!found) {
|
|
21
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
22
|
+
if (!sandbox_id) {
|
|
25
23
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
26
24
|
}
|
|
27
25
|
const confirmed = options.force ||
|
|
28
26
|
(await output_1.default.confirm((0, texts_1.OPTION_SANDBOX_COMMAND_KILL_CONFIRM)(identifier, commandId)));
|
|
29
27
|
if (!confirmed)
|
|
30
28
|
output_1.default.exitNormal();
|
|
31
|
-
await client.terminateSandboxCommand(workspace,
|
|
29
|
+
await client.terminateSandboxCommand(workspace, sandbox_id, commandId);
|
|
32
30
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_COMMAND_KILLED)(commandId));
|
|
33
31
|
});
|
|
34
32
|
exports.default = commandSandboxExecKill;
|
|
@@ -17,13 +17,11 @@ commandSandboxExecList.action(async (identifier, options) => {
|
|
|
17
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
18
|
const project = input_1.default.restApiProject(options.project);
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
-
if (!found) {
|
|
20
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
21
|
+
if (!sandbox_id) {
|
|
24
22
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
23
|
}
|
|
26
|
-
const commandsResult = await client.listSandboxCommands(workspace,
|
|
24
|
+
const commandsResult = await client.listSandboxCommands(workspace, sandbox_id);
|
|
27
25
|
const commands = commandsResult.commands || [];
|
|
28
26
|
if (commands.length === 0) {
|
|
29
27
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NO_COMMANDS);
|
|
@@ -19,13 +19,11 @@ commandSandboxExecLogs.action(async (identifier, commandId, options) => {
|
|
|
19
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
20
|
const project = input_1.default.restApiProject(options.project);
|
|
21
21
|
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
25
|
-
if (!found) {
|
|
22
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
23
|
+
if (!sandbox_id) {
|
|
26
24
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
27
25
|
}
|
|
28
|
-
const body = await client.streamSandboxCommandLogs(workspace,
|
|
26
|
+
const body = await client.streamSandboxCommandLogs(workspace, sandbox_id, commandId, !!options.wait);
|
|
29
27
|
body.on('data', (data) => {
|
|
30
28
|
if (data) {
|
|
31
29
|
try {
|
|
@@ -42,7 +40,7 @@ commandSandboxExecLogs.action(async (identifier, commandId, options) => {
|
|
|
42
40
|
}
|
|
43
41
|
});
|
|
44
42
|
body.on('close', async () => {
|
|
45
|
-
const cmdExit = await client.getSandboxCommand(workspace,
|
|
43
|
+
const cmdExit = await client.getSandboxCommand(workspace, sandbox_id, commandId);
|
|
46
44
|
if (cmdExit.status === utils_1.SANDBOX_EXEC_STATUS.SUCCESSFUL) {
|
|
47
45
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_EXEC_SUCCESS)(commandId));
|
|
48
46
|
}
|
|
@@ -17,13 +17,11 @@ commandSandboxExecStatus.action(async (identifier, commandId, options) => {
|
|
|
17
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
18
|
const project = input_1.default.restApiProject(options.project);
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
-
if (!found) {
|
|
20
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
21
|
+
if (!sandbox_id) {
|
|
24
22
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
23
|
}
|
|
26
|
-
const cmd = await client.getSandboxCommand(workspace,
|
|
24
|
+
const cmd = await client.getSandboxCommand(workspace, sandbox_id, commandId);
|
|
27
25
|
const data = [
|
|
28
26
|
['Property', 'Value'],
|
|
29
27
|
['Command ID', cmd.id || '-'],
|
|
@@ -15,13 +15,11 @@ commandSandboxGet.action(async (identifier, options) => {
|
|
|
15
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
16
|
const project = input_1.default.restApiProject(options.project);
|
|
17
17
|
const client = input_1.default.restApiTokenClient();
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
21
|
-
if (!found) {
|
|
18
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
19
|
+
if (!sandbox_id) {
|
|
22
20
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
23
21
|
}
|
|
24
|
-
const sandbox = await client.getSandbox(workspace,
|
|
22
|
+
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
25
23
|
const data = [
|
|
26
24
|
['Field', 'Value'],
|
|
27
25
|
['ID', sandbox.id || '-'],
|
|
@@ -16,18 +16,16 @@ commandSandboxRestart.action(async (identifier, options) => {
|
|
|
16
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
17
|
const project = input_1.default.restApiProject(options.project);
|
|
18
18
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
22
|
-
if (!found) {
|
|
19
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
20
|
+
if (!sandbox_id) {
|
|
23
21
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
22
|
}
|
|
25
|
-
await client.restartSandbox(workspace,
|
|
23
|
+
await client.restartSandbox(workspace, sandbox_id);
|
|
26
24
|
if (options.wait) {
|
|
27
25
|
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
|
|
28
26
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
29
27
|
try {
|
|
30
|
-
const status = await client.sandboxWaitForRunning(workspace,
|
|
28
|
+
const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
|
|
31
29
|
if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
|
|
32
30
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
|
|
33
31
|
}
|
|
@@ -20,10 +20,8 @@ commandSandboxSnapshotCreate.action(async (identifier, options) => {
|
|
|
20
20
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
21
21
|
const project = input_1.default.restApiProject(options.project);
|
|
22
22
|
const client = input_1.default.restApiTokenClient();
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
26
|
-
if (!found) {
|
|
23
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
24
|
+
if (!sandbox_id) {
|
|
27
25
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
28
26
|
}
|
|
29
27
|
const defaultName = 'snapshot-' + (0, human_id_1.default)({ separator: '-', capitalize: false });
|
|
@@ -31,13 +29,13 @@ commandSandboxSnapshotCreate.action(async (identifier, options) => {
|
|
|
31
29
|
const body = {
|
|
32
30
|
name: snapshotName,
|
|
33
31
|
};
|
|
34
|
-
const snapshot = await client.createSandboxSnapshot(workspace,
|
|
32
|
+
const snapshot = await client.createSandboxSnapshot(workspace, sandbox_id, body);
|
|
35
33
|
const snapshotId = snapshot.id;
|
|
36
34
|
if (options.wait) {
|
|
37
35
|
output_1.default.normal(texts_1.TXT_SANDBOX_SNAPSHOT_WAITING);
|
|
38
36
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
39
37
|
try {
|
|
40
|
-
const status = await client.sandboxWaitForSnapshot(workspace,
|
|
38
|
+
const status = await client.sandboxWaitForSnapshot(workspace, sandbox_id, snapshotId, timeout);
|
|
41
39
|
if (status !== utils_1.SANDBOX_SNAPSHOT_STATUS.CREATED) {
|
|
42
40
|
output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_FAILED);
|
|
43
41
|
}
|
|
@@ -19,13 +19,11 @@ commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) =>
|
|
|
19
19
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
20
20
|
const project = input_1.default.restApiProject(options.project);
|
|
21
21
|
const client = input_1.default.restApiTokenClient();
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
25
|
-
if (!found) {
|
|
22
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
23
|
+
if (!sandbox_id) {
|
|
26
24
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
27
25
|
}
|
|
28
|
-
const snapshotsResult = await client.listSandboxSnapshots(workspace,
|
|
26
|
+
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
|
|
29
27
|
const snapshots = snapshotsResult.snapshots || [];
|
|
30
28
|
const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
|
|
31
29
|
if (!foundSnapshot) {
|
|
@@ -35,7 +33,7 @@ commandSandboxSnapshotDelete.action(async (identifier, snapshotName, options) =>
|
|
|
35
33
|
(await output_1.default.confirm((0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETE_CONFIRM)(identifier, snapshotName)));
|
|
36
34
|
if (!confirmed)
|
|
37
35
|
output_1.default.exitNormal();
|
|
38
|
-
await client.deleteSandboxSnapshot(workspace,
|
|
36
|
+
await client.deleteSandboxSnapshot(workspace, sandbox_id, foundSnapshot.id);
|
|
39
37
|
output_1.default.exitSuccess((0, texts_1.TXT_SANDBOX_SNAPSHOT_DELETED)(snapshotName));
|
|
40
38
|
});
|
|
41
39
|
exports.default = commandSandboxSnapshotDelete;
|
|
@@ -17,19 +17,17 @@ commandSandboxSnapshotGet.action(async (identifier, snapshotName, options) => {
|
|
|
17
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
18
|
const project = input_1.default.restApiProject(options.project);
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
-
if (!found) {
|
|
20
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
21
|
+
if (!sandbox_id) {
|
|
24
22
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
23
|
}
|
|
26
|
-
const snapshotsResult = await client.listSandboxSnapshots(workspace,
|
|
24
|
+
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
|
|
27
25
|
const snapshots = snapshotsResult.snapshots || [];
|
|
28
26
|
const foundSnapshot = snapshots.find((s) => s.name === snapshotName);
|
|
29
27
|
if (!foundSnapshot) {
|
|
30
28
|
output_1.default.exitError(texts_1.ERR_SANDBOX_SNAPSHOT_NOT_FOUND);
|
|
31
29
|
}
|
|
32
|
-
const snapshot = await client.getSandboxSnapshot(workspace,
|
|
30
|
+
const snapshot = await client.getSandboxSnapshot(workspace, sandbox_id, foundSnapshot.id);
|
|
33
31
|
const data = [
|
|
34
32
|
['Field', 'Value'],
|
|
35
33
|
['Name', snapshot.name || '-'],
|
|
@@ -19,13 +19,11 @@ commandSandboxSnapshotList.action(async (identifier, options) => {
|
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
20
|
let snapshots;
|
|
21
21
|
if (identifier) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
25
|
-
if (!found) {
|
|
22
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
23
|
+
if (!sandbox_id) {
|
|
26
24
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
27
25
|
}
|
|
28
|
-
const snapshotsResult = await client.listSandboxSnapshots(workspace,
|
|
26
|
+
const snapshotsResult = await client.listSandboxSnapshots(workspace, sandbox_id);
|
|
29
27
|
snapshots = snapshotsResult.snapshots || [];
|
|
30
28
|
}
|
|
31
29
|
else {
|
|
@@ -16,18 +16,16 @@ commandSandboxStart.action(async (identifier, options) => {
|
|
|
16
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
17
|
const project = input_1.default.restApiProject(options.project);
|
|
18
18
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
22
|
-
if (!found) {
|
|
19
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
20
|
+
if (!sandbox_id) {
|
|
23
21
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
22
|
}
|
|
25
|
-
await client.startSandbox(workspace,
|
|
23
|
+
await client.startSandbox(workspace, sandbox_id);
|
|
26
24
|
if (options.wait) {
|
|
27
25
|
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_START);
|
|
28
26
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
29
27
|
try {
|
|
30
|
-
const status = await client.sandboxWaitForRunning(workspace,
|
|
28
|
+
const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
|
|
31
29
|
if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
|
|
32
30
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
|
|
33
31
|
}
|
|
@@ -15,13 +15,11 @@ commandSandboxStatus.action(async (identifier, options) => {
|
|
|
15
15
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
16
16
|
const project = input_1.default.restApiProject(options.project);
|
|
17
17
|
const client = input_1.default.restApiTokenClient();
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
21
|
-
if (!found) {
|
|
18
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
19
|
+
if (!sandbox_id) {
|
|
22
20
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
23
21
|
}
|
|
24
|
-
const sandbox = await client.getSandbox(workspace,
|
|
22
|
+
const sandbox = await client.getSandbox(workspace, sandbox_id);
|
|
25
23
|
output_1.default.table([
|
|
26
24
|
['Type', 'Status'],
|
|
27
25
|
['Status', sandbox.status || 'UNKNOWN'],
|
|
@@ -16,18 +16,16 @@ commandSandboxStop.action(async (identifier, options) => {
|
|
|
16
16
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
17
17
|
const project = input_1.default.restApiProject(options.project);
|
|
18
18
|
const client = input_1.default.restApiTokenClient();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
22
|
-
if (!found) {
|
|
19
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
20
|
+
if (!sandbox_id) {
|
|
23
21
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
24
22
|
}
|
|
25
|
-
await client.stopSandbox(workspace,
|
|
23
|
+
await client.stopSandbox(workspace, sandbox_id);
|
|
26
24
|
if (options.wait) {
|
|
27
25
|
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_STOP);
|
|
28
26
|
const timeout = parseInt(options.wait, 10) || 300;
|
|
29
27
|
try {
|
|
30
|
-
const status = await client.sandboxWaitForRunning(workspace,
|
|
28
|
+
const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
|
|
31
29
|
if (status !== utils_1.SANDBOX_STATUS.STOPPED) {
|
|
32
30
|
output_1.default.exitError(texts_1.ERR_SANDBOX_STOP_FAILED);
|
|
33
31
|
}
|
|
@@ -21,22 +21,19 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
|
21
21
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
22
22
|
const project = input_1.default.restApiProject(options.project);
|
|
23
23
|
const client = input_1.default.restApiTokenClient();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
27
|
-
if (!found) {
|
|
24
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
25
|
+
if (!sandbox_id) {
|
|
28
26
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
29
27
|
}
|
|
30
|
-
const sandboxId = found.id;
|
|
31
28
|
const body = {
|
|
32
29
|
yaml: Buffer.from(yaml, 'utf8').toString('base64'),
|
|
33
30
|
};
|
|
34
|
-
result = await client.updateSandboxByYaml(workspace,
|
|
31
|
+
const result = await client.updateSandboxByYaml(workspace, sandbox_id, body);
|
|
35
32
|
if (options.waitForRunning) {
|
|
36
33
|
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_RUNNING);
|
|
37
34
|
const timeout = parseInt(options.waitForRunning, 10) || 300;
|
|
38
35
|
try {
|
|
39
|
-
const status = await client.sandboxWaitForRunning(workspace,
|
|
36
|
+
const status = await client.sandboxWaitForRunning(workspace, sandbox_id, timeout);
|
|
40
37
|
if (status !== utils_1.SANDBOX_STATUS.RUNNING) {
|
|
41
38
|
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_FAILED);
|
|
42
39
|
}
|
|
@@ -49,7 +46,7 @@ commandSandboxUpdate.action(async (identifier, yamlFile, options) => {
|
|
|
49
46
|
output_1.default.normal(texts_1.TXT_SANDBOX_WAITING_SETUP);
|
|
50
47
|
const timeout = parseInt(options.waitForConfigured, 10) || 300;
|
|
51
48
|
try {
|
|
52
|
-
const status = await client.sandboxWaitForConfigured(workspace,
|
|
49
|
+
const status = await client.sandboxWaitForConfigured(workspace, sandbox_id, timeout);
|
|
53
50
|
if (status !== utils_1.SANDBOX_SETUP_STATUS.SUCCESS) {
|
|
54
51
|
output_1.default.exitError(texts_1.ERR_SANDBOX_SETUP_FAILED);
|
|
55
52
|
}
|
|
@@ -17,14 +17,11 @@ commandSandboxYaml.action(async (identifier, options) => {
|
|
|
17
17
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
18
18
|
const project = input_1.default.restApiProject(options.project);
|
|
19
19
|
const client = input_1.default.restApiTokenClient();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const found = sandboxes.find((s) => s.identifier === identifier);
|
|
23
|
-
if (!found) {
|
|
20
|
+
const { sandbox_id } = await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
21
|
+
if (!sandbox_id) {
|
|
24
22
|
output_1.default.exitError(texts_1.ERR_SANDBOX_NOT_FOUND);
|
|
25
23
|
}
|
|
26
|
-
const
|
|
27
|
-
result = await client.getSandboxYaml(workspace, sandboxId);
|
|
24
|
+
const result = await client.getSandboxYaml(workspace, sandbox_id);
|
|
28
25
|
output_1.default.exitNormal(Buffer.from(result.yaml, 'base64').toString('utf8'));
|
|
29
26
|
});
|
|
30
27
|
exports.default = commandSandboxYaml;
|
package/distTs/src/output.js
CHANGED
|
@@ -63,6 +63,12 @@ class Output {
|
|
|
63
63
|
},
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
+
static getOkSign() {
|
|
67
|
+
return '✔ ';
|
|
68
|
+
}
|
|
69
|
+
static okSign(newLine = false) {
|
|
70
|
+
return this.cyan(this.getOkSign(), newLine);
|
|
71
|
+
}
|
|
66
72
|
static exitSuccess(msg) {
|
|
67
73
|
this.exitNormal(this.getGreenColor(msg));
|
|
68
74
|
}
|
|
@@ -75,6 +81,12 @@ class Output {
|
|
|
75
81
|
static newline() {
|
|
76
82
|
terminal('\n');
|
|
77
83
|
}
|
|
84
|
+
static light(txt, newLine = true) {
|
|
85
|
+
this.normal(this.getLightColor(txt), newLine);
|
|
86
|
+
}
|
|
87
|
+
static muted(txt, newLine = true) {
|
|
88
|
+
this.normal(this.getMutedColor(txt), newLine);
|
|
89
|
+
}
|
|
78
90
|
static normal(txt, newLine = true) {
|
|
79
91
|
let msg = txt;
|
|
80
92
|
if (newLine)
|
|
@@ -93,6 +105,12 @@ class Output {
|
|
|
93
105
|
static green(txt, newLine = true) {
|
|
94
106
|
this.normal(this.getGreenColor(txt), newLine);
|
|
95
107
|
}
|
|
108
|
+
static label(txt, newLine = true) {
|
|
109
|
+
this.normal(this.getLabelColor(txt), newLine);
|
|
110
|
+
}
|
|
111
|
+
static dim(txt, newLine = true) {
|
|
112
|
+
this.normal(this.getDimColor(txt), newLine);
|
|
113
|
+
}
|
|
96
114
|
static blue(txt, newLine = true) {
|
|
97
115
|
this.normal(this.getBlueColor(txt), newLine);
|
|
98
116
|
}
|
|
@@ -230,13 +248,13 @@ class Output {
|
|
|
230
248
|
});
|
|
231
249
|
}
|
|
232
250
|
this.cyan('? ', false);
|
|
233
|
-
this.
|
|
251
|
+
this.label(message, false);
|
|
234
252
|
this.cyan(` No`);
|
|
235
253
|
return false;
|
|
236
254
|
}
|
|
237
255
|
static async inputString(message, def) {
|
|
238
256
|
if (this.isStdInTTY()) {
|
|
239
|
-
await prompts_1.default.input({
|
|
257
|
+
return await prompts_1.default.input({
|
|
240
258
|
message,
|
|
241
259
|
default: def,
|
|
242
260
|
theme: this.getInquirerTheme()
|
|
@@ -251,6 +269,25 @@ class Output {
|
|
|
251
269
|
this.normal('');
|
|
252
270
|
return '';
|
|
253
271
|
}
|
|
272
|
+
static async inputMenuAdv(message, items) {
|
|
273
|
+
if (this.isStdInTTY()) {
|
|
274
|
+
return await prompts_1.default.select({
|
|
275
|
+
message,
|
|
276
|
+
theme: this.getInquirerTheme(),
|
|
277
|
+
choices: items
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
this.cyan('? ', false);
|
|
282
|
+
this.normal(message, false);
|
|
283
|
+
if (items.length > 0) {
|
|
284
|
+
this.cyan(` ${items[0].name}`);
|
|
285
|
+
return items[0].value;
|
|
286
|
+
}
|
|
287
|
+
this.normal('');
|
|
288
|
+
return '';
|
|
289
|
+
}
|
|
290
|
+
}
|
|
254
291
|
static async inputMenu(message, items) {
|
|
255
292
|
if (this.isStdInTTY()) {
|
|
256
293
|
return await prompts_1.default.select({
|
package/distTs/src/texts.js
CHANGED
|
@@ -12,8 +12,8 @@ exports.OPTION_SANDBOX_APP_TYPE = exports.OPTION_SANDBOX_APP_DIR = exports.OPTIO
|
|
|
12
12
|
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 = 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_UPDATED = 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 = void 0;
|
|
13
13
|
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_WORKSPACE = exports.DESC_COMMAND_WHOAMI = exports.TXT_SANDBOX_EXEC_FAILED = exports.TXT_SANDBOX_EXEC_INPROGRESS = exports.TXT_SANDBOX_EXEC_SUCCESS = 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 = void 0;
|
|
14
14
|
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_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 = 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_SCHEMA = 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 = void 0;
|
|
15
|
-
exports.
|
|
16
|
-
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 = void 0;
|
|
15
|
+
exports.EXAMPLE_SANDBOX_CREATE = exports.EXAMPLE_SANDBOX_CP = exports.ERR_PROJECT_NO_PROJECTS = exports.TXT_LOGIN_SELECT_PROJECT = exports.TXT_COMMAND_PROJECT_CREATED = exports.TXT_COMMAND_PROJECT_LINK_NOT_FOUND = exports.TXT_COMMAND_PROJECT_LINK_NAME = exports.TXT_COMMAND_PROJECT_LINK_SELECT_PROJECT = exports.TXT_COMMAND_PROJECT_LINK_TO = exports.TXT_COMMAND_PROJECT_LINK_EXISTING_DESC = exports.TXT_COMMAND_PROJECT_LINK_EXISTING = exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW_DESC = exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW = exports.ERR_COMMAND_PROJECT_LINK_DIR_NOT_DIR = exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO_INITIALIZED = exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO = exports.TXT_COMMAND_PROJECT_LINK_DIR_CONFIRM = exports.TXT_COMMAND_PROJECT_LINK_DIR_LINKED = exports.ERR_COMMAND_PROJECT_LINK_DIR_CREATE = exports.OPT_COMMAND_PROJECT_LINK_TRY_NOW = exports.OPT_COMMAND_PROJECT_LINK_SET_GIT_REMOTE = exports.OPT_COMMAND_PROJECT_LINK_HAS_REMOTE = exports.OPT_COMMAND_PROJECT_LINK_DIRECTORY = exports.OPT_COMMAND_PROJECT_LINK_GIT = exports.OPT_COMMAND_PROJECT_LINK_RELINK = exports.DESC_COMMAND_PROJECT_LINK = exports.DESC_COMMAND_PROJECT_LIST = exports.DESC_COMMAND_PROJECT_GIT = exports.DESC_COMMAND_PROJECT_GIT_CREDENTIAL = 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 = void 0;
|
|
16
|
+
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 = exports.EXAMPLE_AGENT_TUNNEL_LIST = exports.EXAMPLE_TUNNEL_HTTP = void 0;
|
|
17
17
|
const utils_1 = require("./utils");
|
|
18
18
|
exports.ERR_REST_API_GENERAL_ERROR = 'Something went wrong';
|
|
19
19
|
exports.ERR_REST_API_NOT_RESPONDING = 'Api endpoint not responding. Try again later...';
|
|
@@ -846,22 +846,26 @@ exports.DESC_COMMAND_PROJECT_LINK = 'Link directory with project in Buddy';
|
|
|
846
846
|
exports.OPT_COMMAND_PROJECT_LINK_RELINK = 'Force relinking directory if already linked to project';
|
|
847
847
|
exports.OPT_COMMAND_PROJECT_LINK_GIT = 'Force initialization of GIT repository';
|
|
848
848
|
exports.OPT_COMMAND_PROJECT_LINK_DIRECTORY = 'Path to directory where link the project';
|
|
849
|
-
exports.OPT_COMMAND_PROJECT_LINK_HAS_REMOTE = '
|
|
850
|
-
exports.
|
|
849
|
+
exports.OPT_COMMAND_PROJECT_LINK_HAS_REMOTE = '! GIT REMOTE ALREADY SET';
|
|
850
|
+
exports.OPT_COMMAND_PROJECT_LINK_SET_GIT_REMOTE = 'SET GIT REMOTE';
|
|
851
|
+
exports.OPT_COMMAND_PROJECT_LINK_TRY_NOW = 'TRY NOW';
|
|
851
852
|
const ERR_COMMAND_PROJECT_LINK_DIR_CREATE = (dir) => `Cannot create directory ${dir}`;
|
|
852
853
|
exports.ERR_COMMAND_PROJECT_LINK_DIR_CREATE = ERR_COMMAND_PROJECT_LINK_DIR_CREATE;
|
|
853
|
-
exports.TXT_COMMAND_PROJECT_LINK_DIR_LINKED = '
|
|
854
|
-
exports.TXT_COMMAND_PROJECT_LINK_DIR_CONFIRM = '
|
|
855
|
-
exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO = '
|
|
856
|
-
|
|
857
|
-
exports.TXT_COMMAND_PROJECT_LINKED = TXT_COMMAND_PROJECT_LINKED;
|
|
854
|
+
exports.TXT_COMMAND_PROJECT_LINK_DIR_LINKED = '! PROJECT ALREADY LINKED';
|
|
855
|
+
exports.TXT_COMMAND_PROJECT_LINK_DIR_CONFIRM = 'RELINK TO A DIFFERENT PROJECT';
|
|
856
|
+
exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO = 'INITIALIZE GIT REPOSITORY';
|
|
857
|
+
exports.TXT_COMMAND_PROJECT_LINK_GIT_REPO_INITIALIZED = 'Git repository initialized';
|
|
858
858
|
exports.ERR_COMMAND_PROJECT_LINK_DIR_NOT_DIR = 'Path is not a directory';
|
|
859
|
-
exports.
|
|
859
|
+
exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW = 'Create new';
|
|
860
|
+
exports.TXT_COMMAND_PROJECT_LINK_CREATE_NEW_DESC = 'Create a new project in the current workspace';
|
|
861
|
+
exports.TXT_COMMAND_PROJECT_LINK_EXISTING = 'Link existing';
|
|
862
|
+
exports.TXT_COMMAND_PROJECT_LINK_EXISTING_DESC = 'Link this directory to an existing project';
|
|
863
|
+
exports.TXT_COMMAND_PROJECT_LINK_TO = 'Project linked to';
|
|
864
|
+
exports.TXT_COMMAND_PROJECT_LINK_SELECT_PROJECT = 'PROJECT';
|
|
860
865
|
exports.TXT_COMMAND_PROJECT_LINK_NAME = 'Provide project name:';
|
|
861
|
-
const TXT_COMMAND_PROJECT_LINK_NOT_FOUND = (project) =>
|
|
866
|
+
const TXT_COMMAND_PROJECT_LINK_NOT_FOUND = (project) => `! PROJECT ${project} NOT FOUND. CREATING NEW...`;
|
|
862
867
|
exports.TXT_COMMAND_PROJECT_LINK_NOT_FOUND = TXT_COMMAND_PROJECT_LINK_NOT_FOUND;
|
|
863
|
-
|
|
864
|
-
exports.TXT_COMMAND_PROJECT_LINK_RANDOM = TXT_COMMAND_PROJECT_LINK_RANDOM;
|
|
868
|
+
exports.TXT_COMMAND_PROJECT_CREATED = 'Project created';
|
|
865
869
|
const TXT_LOGIN_SELECT_PROJECT = (optional) => `Select project (${optional ? 'optional' : 'required'}):`;
|
|
866
870
|
exports.TXT_LOGIN_SELECT_PROJECT = TXT_LOGIN_SELECT_PROJECT;
|
|
867
871
|
exports.ERR_PROJECT_NO_PROJECTS = 'No projects found in this workspace';
|