@codebolt/codeboltjs 1.1.60 → 1.1.62
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/index.d.ts +3 -3
- package/modules/terminal.d.ts +3 -3
- package/modules/terminal.js +6 -3
- package/modules/websocket.js +1 -1
- package/package.json +1 -1
- package/src/modules/terminal.ts +7 -4
- package/src/modules/websocket.ts +1 -1
- package/tsconfig.json +1 -1
package/index.d.ts
CHANGED
|
@@ -130,10 +130,10 @@ declare class Codebolt {
|
|
|
130
130
|
prependOnceListener<K_11>(eventName: string | symbol, listener: (...args: any[]) => void): any;
|
|
131
131
|
eventNames(): (string | symbol)[];
|
|
132
132
|
};
|
|
133
|
-
executeCommand: (command: string) => Promise<import("@codebolt/types").CommandOutput | import("@codebolt/types").CommandError>;
|
|
134
|
-
executeCommandRunUntilError: (command: string) => Promise<import("@codebolt/types").CommandError>;
|
|
133
|
+
executeCommand: (command: string, executeInMain?: boolean) => Promise<import("@codebolt/types").CommandOutput | import("@codebolt/types").CommandError>;
|
|
134
|
+
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<import("@codebolt/types").CommandError>;
|
|
135
135
|
sendManualInterrupt(): Promise<import("@codebolt/types").TerminalInterruptResponse>;
|
|
136
|
-
executeCommandWithStream(command: string): EventEmitter<[never]>;
|
|
136
|
+
executeCommandWithStream(command: string, executeInMain?: boolean): EventEmitter<[never]>;
|
|
137
137
|
};
|
|
138
138
|
codeutils: {
|
|
139
139
|
getJsTree: (filePath?: string | undefined) => Promise<any>;
|
package/modules/terminal.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ declare const cbterminal: {
|
|
|
19
19
|
* @param {string} command - The command to be executed.
|
|
20
20
|
* @returns {Promise<CommandOutput|CommandError>} A promise that resolves with the command's output, error, or finish signal.
|
|
21
21
|
*/
|
|
22
|
-
executeCommand: (command: string) => Promise<CommandOutput | CommandError>;
|
|
22
|
+
executeCommand: (command: string, executeInMain?: boolean) => Promise<CommandOutput | CommandError>;
|
|
23
23
|
/**
|
|
24
24
|
* Executes a given command and keeps running until an error occurs.
|
|
25
25
|
* Listens for messages from the WebSocket and resolves the promise when an error is encountered.
|
|
@@ -27,7 +27,7 @@ declare const cbterminal: {
|
|
|
27
27
|
* @param {string} command - The command to be executed.
|
|
28
28
|
* @returns {Promise<CommandError>} A promise that resolves when an error occurs during command execution.
|
|
29
29
|
*/
|
|
30
|
-
executeCommandRunUntilError: (command: string) => Promise<CommandError>;
|
|
30
|
+
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<CommandError>;
|
|
31
31
|
/**
|
|
32
32
|
* Sends a manual interrupt signal to the terminal.
|
|
33
33
|
*
|
|
@@ -41,6 +41,6 @@ declare const cbterminal: {
|
|
|
41
41
|
* @param {string} command - The command to be executed.
|
|
42
42
|
* @returns {EventEmitter} A promise that streams the output data during command execution.
|
|
43
43
|
*/
|
|
44
|
-
executeCommandWithStream(command: string): EventEmitter;
|
|
44
|
+
executeCommandWithStream(command: string, executeInMain?: boolean): EventEmitter;
|
|
45
45
|
};
|
|
46
46
|
export default cbterminal;
|
package/modules/terminal.js
CHANGED
|
@@ -23,11 +23,12 @@ const cbterminal = {
|
|
|
23
23
|
* @param {string} command - The command to be executed.
|
|
24
24
|
* @returns {Promise<CommandOutput|CommandError>} A promise that resolves with the command's output, error, or finish signal.
|
|
25
25
|
*/
|
|
26
|
-
executeCommand: async (command) => {
|
|
26
|
+
executeCommand: async (command, executeInMain = false) => {
|
|
27
27
|
return new Promise((resolve, reject) => {
|
|
28
28
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
29
29
|
"type": "executeCommand",
|
|
30
30
|
"message": command,
|
|
31
|
+
executeInMain
|
|
31
32
|
}));
|
|
32
33
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
33
34
|
const response = JSON.parse(data);
|
|
@@ -44,11 +45,12 @@ const cbterminal = {
|
|
|
44
45
|
* @param {string} command - The command to be executed.
|
|
45
46
|
* @returns {Promise<CommandError>} A promise that resolves when an error occurs during command execution.
|
|
46
47
|
*/
|
|
47
|
-
executeCommandRunUntilError: async (command) => {
|
|
48
|
+
executeCommandRunUntilError: async (command, executeInMain = false) => {
|
|
48
49
|
return new Promise((resolve, reject) => {
|
|
49
50
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
50
51
|
"type": "executeCommandRunUntilError",
|
|
51
52
|
"message": command,
|
|
53
|
+
executeInMain
|
|
52
54
|
}));
|
|
53
55
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
54
56
|
const response = JSON.parse(data);
|
|
@@ -83,11 +85,12 @@ const cbterminal = {
|
|
|
83
85
|
* @param {string} command - The command to be executed.
|
|
84
86
|
* @returns {EventEmitter} A promise that streams the output data during command execution.
|
|
85
87
|
*/
|
|
86
|
-
executeCommandWithStream(command) {
|
|
88
|
+
executeCommandWithStream(command, executeInMain = false) {
|
|
87
89
|
// Send the process started message
|
|
88
90
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
89
91
|
"type": "executeCommandWithStream",
|
|
90
92
|
"message": command,
|
|
93
|
+
executeInMain
|
|
91
94
|
}));
|
|
92
95
|
// Register event listener for WebSocket messages
|
|
93
96
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
package/modules/websocket.js
CHANGED
|
@@ -17,7 +17,7 @@ class cbws {
|
|
|
17
17
|
const uniqueConnectionId = this.getUniqueConnectionId();
|
|
18
18
|
const initialMessage = this.getInitialMessage();
|
|
19
19
|
console.log(uniqueConnectionId);
|
|
20
|
-
this.websocket = new ws_1.default(`ws://localhost
|
|
20
|
+
this.websocket = new ws_1.default(`ws://localhost:${process.env.SOCKET_PORT}/codebolt?id=${uniqueConnectionId}`);
|
|
21
21
|
this.initializeWebSocket(initialMessage).catch(error => {
|
|
22
22
|
console.error("WebSocket connection failed:", error);
|
|
23
23
|
});
|
package/package.json
CHANGED
package/src/modules/terminal.ts
CHANGED
|
@@ -19,11 +19,12 @@ const cbterminal = {
|
|
|
19
19
|
* @param {string} command - The command to be executed.
|
|
20
20
|
* @returns {Promise<CommandOutput|CommandError>} A promise that resolves with the command's output, error, or finish signal.
|
|
21
21
|
*/
|
|
22
|
-
executeCommand: async (command: string): Promise<CommandOutput|CommandError> => {
|
|
22
|
+
executeCommand: async (command: string,executeInMain=false): Promise<CommandOutput|CommandError> => {
|
|
23
23
|
return new Promise((resolve, reject) => {
|
|
24
24
|
cbws.getWebsocket.send(JSON.stringify({
|
|
25
25
|
"type": "executeCommand",
|
|
26
26
|
"message": command,
|
|
27
|
+
executeInMain
|
|
27
28
|
}));
|
|
28
29
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
29
30
|
const response = JSON.parse(data);
|
|
@@ -41,11 +42,12 @@ const cbterminal = {
|
|
|
41
42
|
* @param {string} command - The command to be executed.
|
|
42
43
|
* @returns {Promise<CommandError>} A promise that resolves when an error occurs during command execution.
|
|
43
44
|
*/
|
|
44
|
-
executeCommandRunUntilError: async (command: string): Promise<CommandError> => {
|
|
45
|
+
executeCommandRunUntilError: async (command: string,executeInMain=false): Promise<CommandError> => {
|
|
45
46
|
return new Promise((resolve, reject) => {
|
|
46
47
|
cbws.getWebsocket.send(JSON.stringify({
|
|
47
48
|
"type": "executeCommandRunUntilError",
|
|
48
49
|
"message": command,
|
|
50
|
+
executeInMain
|
|
49
51
|
}));
|
|
50
52
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
51
53
|
const response = JSON.parse(data);
|
|
@@ -84,11 +86,12 @@ const cbterminal = {
|
|
|
84
86
|
* @param {string} command - The command to be executed.
|
|
85
87
|
* @returns {EventEmitter} A promise that streams the output data during command execution.
|
|
86
88
|
*/
|
|
87
|
-
executeCommandWithStream(command: string):EventEmitter {
|
|
89
|
+
executeCommandWithStream(command: string,executeInMain=false):EventEmitter {
|
|
88
90
|
// Send the process started message
|
|
89
91
|
cbws.getWebsocket.send(JSON.stringify({
|
|
90
92
|
"type": "executeCommandWithStream",
|
|
91
|
-
"message": command
|
|
93
|
+
"message": command
|
|
94
|
+
,executeInMain
|
|
92
95
|
}));
|
|
93
96
|
// Register event listener for WebSocket messages
|
|
94
97
|
cbws.getWebsocket.on('message', (data: string) => {
|
package/src/modules/websocket.ts
CHANGED
|
@@ -15,7 +15,7 @@ class cbws {
|
|
|
15
15
|
const uniqueConnectionId = this.getUniqueConnectionId();
|
|
16
16
|
const initialMessage = this.getInitialMessage();
|
|
17
17
|
console.log(uniqueConnectionId)
|
|
18
|
-
this.websocket = new WebSocket(`ws://localhost
|
|
18
|
+
this.websocket = new WebSocket(`ws://localhost:${process.env.SOCKET_PORT}/codebolt?id=${uniqueConnectionId}`);
|
|
19
19
|
this.initializeWebSocket(initialMessage).catch(error => {
|
|
20
20
|
console.error("WebSocket connection failed:", error);
|
|
21
21
|
});
|
package/tsconfig.json
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
33
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
34
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
|
|
35
|
+
"types": ["node"], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
36
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
37
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
38
|
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|