@codebolt/codeboltjs 1.1.16 → 1.1.18
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/modules/terminal.d.ts +4 -8
- package/modules/terminal.js +6 -11
- package/package.json +1 -1
- package/src/modules/terminal.ts +11 -13
package/modules/terminal.d.ts
CHANGED
|
@@ -28,13 +28,11 @@ declare const cbterminal: {
|
|
|
28
28
|
*/
|
|
29
29
|
executeCommandRunUntilError: (command: string) => Promise<any>;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
* Listens for messages from the WebSocket and resolves the promise when an interruption signal is received.
|
|
31
|
+
* Sends a manual interrupt signal to the terminal.
|
|
33
32
|
*
|
|
34
|
-
* @
|
|
35
|
-
* @returns {Promise<any>} A promise that resolves when an interruption signal is received during command execution.
|
|
33
|
+
* @returns {void}
|
|
36
34
|
*/
|
|
37
|
-
|
|
35
|
+
sendManualInterrupt(): Promise<any>;
|
|
38
36
|
/**
|
|
39
37
|
* Executes a given command and streams the output.
|
|
40
38
|
* Listens for messages from the WebSocket and streams the output data.
|
|
@@ -42,8 +40,6 @@ declare const cbterminal: {
|
|
|
42
40
|
* @param {string} command - The command to be executed.
|
|
43
41
|
* @returns {Promise<any>} A promise that streams the output data during command execution.
|
|
44
42
|
*/
|
|
45
|
-
executeCommandWithStream(command: string):
|
|
46
|
-
event: CustomEventEmitter;
|
|
47
|
-
};
|
|
43
|
+
executeCommandWithStream(command: string): CustomEventEmitter;
|
|
48
44
|
};
|
|
49
45
|
export default cbterminal;
|
package/modules/terminal.js
CHANGED
|
@@ -59,21 +59,18 @@ const cbterminal = {
|
|
|
59
59
|
});
|
|
60
60
|
},
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
* Listens for messages from the WebSocket and resolves the promise when an interruption signal is received.
|
|
62
|
+
* Sends a manual interrupt signal to the terminal.
|
|
64
63
|
*
|
|
65
|
-
* @
|
|
66
|
-
* @returns {Promise<any>} A promise that resolves when an interruption signal is received during command execution.
|
|
64
|
+
* @returns {void}
|
|
67
65
|
*/
|
|
68
|
-
|
|
66
|
+
sendManualInterrupt() {
|
|
69
67
|
return new Promise((resolve, reject) => {
|
|
70
68
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
71
|
-
"type": "
|
|
72
|
-
"message": command,
|
|
69
|
+
"type": "sendInterruptToTerminal"
|
|
73
70
|
}));
|
|
74
71
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
75
72
|
const response = JSON.parse(data);
|
|
76
|
-
if (response.type === "
|
|
73
|
+
if (response.type === "terminalInterrupted") {
|
|
77
74
|
resolve(response);
|
|
78
75
|
}
|
|
79
76
|
});
|
|
@@ -101,9 +98,7 @@ const cbterminal = {
|
|
|
101
98
|
this.eventEmitter.emit("serverEvents", response.response);
|
|
102
99
|
});
|
|
103
100
|
// Return an object that includes the event emitter and the stopProcess method
|
|
104
|
-
return
|
|
105
|
-
event: this.eventEmitter
|
|
106
|
-
};
|
|
101
|
+
return this.eventEmitter;
|
|
107
102
|
}
|
|
108
103
|
};
|
|
109
104
|
exports.default = cbterminal;
|
package/package.json
CHANGED
package/src/modules/terminal.ts
CHANGED
|
@@ -56,22 +56,21 @@ const cbterminal = {
|
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
58
|
|
|
59
|
+
|
|
59
60
|
/**
|
|
60
|
-
*
|
|
61
|
-
* Listens for messages from the WebSocket and resolves the promise when an interruption signal is received.
|
|
61
|
+
* Sends a manual interrupt signal to the terminal.
|
|
62
62
|
*
|
|
63
|
-
* @
|
|
64
|
-
* @returns {Promise<any>} A promise that resolves when an interruption signal is received during command execution.
|
|
63
|
+
* @returns {void}
|
|
65
64
|
*/
|
|
66
|
-
|
|
65
|
+
sendManualInterrupt(): Promise<any> {
|
|
66
|
+
|
|
67
67
|
return new Promise((resolve, reject) => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}));
|
|
68
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
69
|
+
"type": "sendInterruptToTerminal"
|
|
70
|
+
}));
|
|
72
71
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
73
72
|
const response = JSON.parse(data);
|
|
74
|
-
if (response.type === "
|
|
73
|
+
if (response.type === "terminalInterrupted") {
|
|
75
74
|
resolve(response);
|
|
76
75
|
}
|
|
77
76
|
});
|
|
@@ -101,9 +100,8 @@ const cbterminal = {
|
|
|
101
100
|
});
|
|
102
101
|
|
|
103
102
|
// Return an object that includes the event emitter and the stopProcess method
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
};
|
|
103
|
+
return this.eventEmitter
|
|
104
|
+
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
|