@codebolt/codeboltjs 1.1.16 → 1.1.17
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 +7 -1
- package/modules/terminal.js +21 -3
- package/package.json +1 -1
- package/src/modules/terminal.ts +22 -3
package/modules/terminal.d.ts
CHANGED
|
@@ -34,7 +34,13 @@ declare const cbterminal: {
|
|
|
34
34
|
* @param {string} command - The command to be executed.
|
|
35
35
|
* @returns {Promise<any>} A promise that resolves when an interruption signal is received during command execution.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
executeCommandRunUnitlInterrupt: (command: string) => Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Sends a manual interrupt signal to the terminal.
|
|
40
|
+
*
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
sendManualInterrupt(): Promise<any>;
|
|
38
44
|
/**
|
|
39
45
|
* Executes a given command and streams the output.
|
|
40
46
|
* Listens for messages from the WebSocket and streams the output data.
|
package/modules/terminal.js
CHANGED
|
@@ -65,15 +65,33 @@ const cbterminal = {
|
|
|
65
65
|
* @param {string} command - The command to be executed.
|
|
66
66
|
* @returns {Promise<any>} A promise that resolves when an interruption signal is received during command execution.
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
executeCommandRunUnitlInterrupt: async (command) => {
|
|
69
69
|
return new Promise((resolve, reject) => {
|
|
70
70
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
71
|
-
"type": "
|
|
71
|
+
"type": "executeCommandRunUnitlInterrupt",
|
|
72
72
|
"message": command,
|
|
73
73
|
}));
|
|
74
74
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
75
75
|
const response = JSON.parse(data);
|
|
76
|
-
if (response.type === "
|
|
76
|
+
if (response.type === "terminalInterruptResponse") {
|
|
77
|
+
resolve(response);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Sends a manual interrupt signal to the terminal.
|
|
84
|
+
*
|
|
85
|
+
* @returns {void}
|
|
86
|
+
*/
|
|
87
|
+
sendManualInterrupt() {
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
90
|
+
"type": "sendInterruptToTerminal"
|
|
91
|
+
}));
|
|
92
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
93
|
+
const response = JSON.parse(data);
|
|
94
|
+
if (response.type === "terminalInterrupted") {
|
|
77
95
|
resolve(response);
|
|
78
96
|
}
|
|
79
97
|
});
|
package/package.json
CHANGED
package/src/modules/terminal.ts
CHANGED
|
@@ -63,15 +63,34 @@ const cbterminal = {
|
|
|
63
63
|
* @param {string} command - The command to be executed.
|
|
64
64
|
* @returns {Promise<any>} A promise that resolves when an interruption signal is received during command execution.
|
|
65
65
|
*/
|
|
66
|
-
|
|
66
|
+
executeCommandRunUnitlInterrupt: async (command: string): Promise<any> => {
|
|
67
67
|
return new Promise((resolve, reject) => {
|
|
68
68
|
cbws.getWebsocket.send(JSON.stringify({
|
|
69
|
-
"type": "
|
|
69
|
+
"type": "executeCommandRunUnitlInterrupt",
|
|
70
70
|
"message": command,
|
|
71
71
|
}));
|
|
72
72
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
73
73
|
const response = JSON.parse(data);
|
|
74
|
-
if (response.type === "
|
|
74
|
+
if (response.type === "terminalInterruptResponse") {
|
|
75
|
+
resolve(response);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Sends a manual interrupt signal to the terminal.
|
|
82
|
+
*
|
|
83
|
+
* @returns {void}
|
|
84
|
+
*/
|
|
85
|
+
sendManualInterrupt(): Promise<any> {
|
|
86
|
+
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
89
|
+
"type": "sendInterruptToTerminal"
|
|
90
|
+
}));
|
|
91
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
92
|
+
const response = JSON.parse(data);
|
|
93
|
+
if (response.type === "terminalInterrupted") {
|
|
75
94
|
resolve(response);
|
|
76
95
|
}
|
|
77
96
|
});
|