bdy 1.22.77 → 1.22.78-beta
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
CHANGED
package/distTs/package.json
CHANGED
package/distTs/src/api/client.js
CHANGED
|
@@ -871,6 +871,24 @@ class ApiClient {
|
|
|
871
871
|
setTimeout(resolve, timeout * 1000);
|
|
872
872
|
});
|
|
873
873
|
}
|
|
874
|
+
async waitSleepMs(timeout = 10) {
|
|
875
|
+
return new Promise((resolve) => {
|
|
876
|
+
setTimeout(resolve, timeout);
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
async sandboxWaitForPorts(workspace, sandboxId, timeout = 10) {
|
|
880
|
+
const end = Date.now() + timeout * 1000;
|
|
881
|
+
for (;;) {
|
|
882
|
+
const sb = await this.getSandbox(workspace, sandboxId);
|
|
883
|
+
if (sb.ssh_host && sb.ssh_port) {
|
|
884
|
+
return sb;
|
|
885
|
+
}
|
|
886
|
+
if (Date.now() > end) {
|
|
887
|
+
throw new Error('timeout');
|
|
888
|
+
}
|
|
889
|
+
await this.waitSleepMs(1000);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
874
892
|
async sandboxWaitForApps(workspace, sandboxId, timeout = 300) {
|
|
875
893
|
const end = Date.now() + timeout * 1000;
|
|
876
894
|
for (;;) {
|
|
@@ -948,7 +966,7 @@ class ApiClient {
|
|
|
948
966
|
}
|
|
949
967
|
}
|
|
950
968
|
return {
|
|
951
|
-
projects
|
|
969
|
+
projects,
|
|
952
970
|
};
|
|
953
971
|
}
|
|
954
972
|
async getProjects(workspace, page = 1, perPage = 100) {
|
|
@@ -1096,7 +1114,7 @@ class ApiClient {
|
|
|
1096
1114
|
}
|
|
1097
1115
|
async createArtifactVersion(workspace, artifactId, version, from) {
|
|
1098
1116
|
const body = {
|
|
1099
|
-
version
|
|
1117
|
+
version,
|
|
1100
1118
|
};
|
|
1101
1119
|
if (from) {
|
|
1102
1120
|
body.from = from;
|
|
@@ -157,6 +157,15 @@ commandSandboxCreate.action(async (options) => {
|
|
|
157
157
|
output_1.default.exitError(texts_1.ERR_SANDBOX_APPS_TIMEOUT);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
if (!result.ssh_host || !result.ssh_port) {
|
|
161
|
+
try {
|
|
162
|
+
await client.waitSleepMs(500);
|
|
163
|
+
result = await client.sandboxWaitForPorts(workspace, sandboxId, 60);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
output_1.default.exitError(texts_1.ERR_SANDBOX_RUNNING_TIMEOUT);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
160
169
|
output_1.default.dim('Identifier: ', false);
|
|
161
170
|
output_1.default.cyan(result.identifier);
|
|
162
171
|
output_1.default.dim('SSH: ', false);
|
|
@@ -170,6 +170,14 @@ class SshClient extends events_1.default {
|
|
|
170
170
|
this.keepalive = false;
|
|
171
171
|
this.close();
|
|
172
172
|
}
|
|
173
|
+
retry() {
|
|
174
|
+
this.close();
|
|
175
|
+
this.emit(tunnel_1.TUNNEL_SSH_EVENT.DISCONNECTED);
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
if (this.keepalive)
|
|
178
|
+
this.openKeepAlive();
|
|
179
|
+
}, 3000);
|
|
180
|
+
}
|
|
173
181
|
openKeepAlive() {
|
|
174
182
|
logger_1.default.debug(`SSH client open`);
|
|
175
183
|
this.keepalive = true;
|
|
@@ -612,10 +612,10 @@ class Tunnel extends events_1.default {
|
|
|
612
612
|
}
|
|
613
613
|
catch (err) {
|
|
614
614
|
// reconnect
|
|
615
|
-
logger_1.default.
|
|
616
|
-
logger_1.default.
|
|
615
|
+
logger_1.default.error((0, texts_1.LOG_TUNNEL_FAILED)(this.id));
|
|
616
|
+
logger_1.default.error(err);
|
|
617
617
|
if (this.ssh)
|
|
618
|
-
this.ssh.
|
|
618
|
+
this.ssh.retry();
|
|
619
619
|
return;
|
|
620
620
|
}
|
|
621
621
|
this.emit(tunnel_1.TUNNEL_EVENT.OPEN, this);
|