@codebolt/codeboltjs 1.1.26 → 1.1.27

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 CHANGED
@@ -86,6 +86,7 @@ declare class Codebolt {
86
86
  event: import("./modules/chat").CustomEventEmitter;
87
87
  stopProcess: () => void;
88
88
  };
89
+ stopProcess: () => void;
89
90
  };
90
91
  terminal: {
91
92
  eventEmitter: import("./modules/terminal").CustomEventEmitter;
@@ -95,7 +96,7 @@ declare class Codebolt {
95
96
  executeCommandWithStream(command: string): import("./modules/terminal").CustomEventEmitter;
96
97
  };
97
98
  codeutils: {
98
- getCodeTree: (fileName: any, source: any, filePath: any) => Promise<any>;
99
+ getCodeTree: () => Promise<any>;
99
100
  getAllFilesAsMarkDown: () => Promise<unknown>;
100
101
  };
101
102
  docutils: {
@@ -155,6 +156,7 @@ declare class Codebolt {
155
156
  };
156
157
  debug: {
157
158
  debug(log: string, type: import("./modules/debug").logType): Promise<unknown>;
159
+ openDebugBrowser(url: string, port: number): Promise<unknown>;
158
160
  };
159
161
  tokenizer: {
160
162
  addToken: (key: string) => Promise<any>;
package/modules/chat.d.ts CHANGED
@@ -30,5 +30,6 @@ declare const cbchat: {
30
30
  event: CustomEventEmitter;
31
31
  stopProcess: () => void;
32
32
  };
33
+ stopProcess: () => void;
33
34
  };
34
35
  export default cbchat;
package/modules/chat.js CHANGED
@@ -90,6 +90,14 @@ const cbchat = {
90
90
  }));
91
91
  }
92
92
  };
93
+ },
94
+ stopProcess: () => {
95
+ // Implement the logic to stop the process here
96
+ console.log("Stopping process...");
97
+ // For example, you might want to send a specific message to the server to stop the process
98
+ websocket_1.default.getWebsocket.send(JSON.stringify({
99
+ "type": "processStoped"
100
+ }));
93
101
  }
94
102
  };
95
103
  exports.default = cbchat;
@@ -9,7 +9,7 @@ declare const cbcodeutils: {
9
9
  * @param {any} filePath - The file path where the source code is located.
10
10
  * @returns {Promise<any>} A promise that resolves with the code tree.
11
11
  */
12
- getCodeTree: (fileName: any, source: any, filePath: any) => Promise<any>;
12
+ getCodeTree: () => Promise<any>;
13
13
  getAllFilesAsMarkDown: () => Promise<unknown>;
14
14
  };
15
15
  export default cbcodeutils;
@@ -15,9 +15,18 @@ const cbcodeutils = {
15
15
  * @param {any} filePath - The file path where the source code is located.
16
16
  * @returns {Promise<any>} A promise that resolves with the code tree.
17
17
  */
18
- getCodeTree: (fileName, source, filePath) => {
18
+ getCodeTree: () => {
19
19
  return new Promise((resolve, reject) => {
20
- // Implementation would go here
20
+ websocket_1.default.getWebsocket.send(JSON.stringify({
21
+ "type": "codeEvent",
22
+ "action": "getCodeTree"
23
+ }));
24
+ websocket_1.default.getWebsocket.on('message', (data) => {
25
+ const response = JSON.parse(data);
26
+ if (response.type === "getCodeTreeResponse") {
27
+ resolve(response.markdown); // Resolve the Promise with the response data
28
+ }
29
+ });
21
30
  });
22
31
  },
23
32
  getAllFilesAsMarkDown: () => {
@@ -5,5 +5,6 @@ export declare enum logType {
5
5
  }
6
6
  export declare const debug: {
7
7
  debug(log: string, type: logType): Promise<unknown>;
8
+ openDebugBrowser(url: string, port: number): Promise<unknown>;
8
9
  };
9
10
  export default debug;
package/modules/debug.js CHANGED
@@ -16,6 +16,7 @@ exports.debug = {
16
16
  return new Promise((resolve, reject) => {
17
17
  websocket_1.default.getWebsocket.send(JSON.stringify({
18
18
  "type": "debugEvent",
19
+ "action": "addLog",
19
20
  message: {
20
21
  log,
21
22
  type
@@ -28,6 +29,24 @@ exports.debug = {
28
29
  }
29
30
  });
30
31
  });
32
+ },
33
+ openDebugBrowser(url, port) {
34
+ return new Promise((resolve, reject) => {
35
+ websocket_1.default.getWebsocket.send(JSON.stringify({
36
+ "type": "debugEvent",
37
+ "action": "openDebugBrowser",
38
+ message: {
39
+ url,
40
+ port
41
+ }
42
+ }));
43
+ websocket_1.default.getWebsocket.on('message', (data) => {
44
+ const response = JSON.parse(data);
45
+ if (response.type === "openDebugBrowserResponse") {
46
+ resolve(response); // Resolve the Promise with the response data
47
+ }
48
+ });
49
+ });
31
50
  }
32
51
  };
33
52
  exports.default = exports.debug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
package/src/index.ts CHANGED
@@ -39,7 +39,6 @@ class Codebolt { // Extend EventEmitter
39
39
  constructor() {
40
40
 
41
41
  this.websocket = cbws.getWebsocket;
42
-
43
42
  }
44
43
  /**
45
44
  * @method setupMessageListener
@@ -92,6 +92,14 @@ const cbchat = {
92
92
  }));
93
93
  }
94
94
  };
95
+ },
96
+ stopProcess: () => {
97
+ // Implement the logic to stop the process here
98
+ console.log("Stopping process...");
99
+ // For example, you might want to send a specific message to the server to stop the process
100
+ cbws.getWebsocket.send(JSON.stringify({
101
+ "type": "processStoped"
102
+ }));
95
103
  }
96
104
  };
97
105
 
@@ -11,9 +11,18 @@ const cbcodeutils = {
11
11
  * @param {any} filePath - The file path where the source code is located.
12
12
  * @returns {Promise<any>} A promise that resolves with the code tree.
13
13
  */
14
- getCodeTree: (fileName: any, source: any, filePath: any): Promise<any> => {
14
+ getCodeTree: (): Promise<any> => {
15
15
  return new Promise((resolve, reject) => {
16
- // Implementation would go here
16
+ cbws.getWebsocket.send(JSON.stringify({
17
+ "type": "codeEvent",
18
+ "action":"getCodeTree"
19
+ }));
20
+ cbws.getWebsocket.on('message', (data: string) => {
21
+ const response = JSON.parse(data);
22
+ if (response.type === "getCodeTreeResponse") {
23
+ resolve(response.markdown); // Resolve the Promise with the response data
24
+ }
25
+ });
17
26
  });
18
27
  },
19
28
  getAllFilesAsMarkDown:()=>{
@@ -12,6 +12,7 @@ export const debug={
12
12
  return new Promise((resolve, reject) => {
13
13
  cbws.getWebsocket.send(JSON.stringify({
14
14
  "type": "debugEvent",
15
+ "action":"addLog",
15
16
  message:{
16
17
  log,
17
18
  type
@@ -26,6 +27,25 @@ export const debug={
26
27
  })
27
28
 
28
29
 
30
+ },
31
+ openDebugBrowser(url:string,port:number){
32
+ return new Promise((resolve, reject) => {
33
+ cbws.getWebsocket.send(JSON.stringify({
34
+ "type": "debugEvent",
35
+ "action":"openDebugBrowser",
36
+ message:{
37
+ url,
38
+ port
39
+ }
40
+ }));
41
+ cbws.getWebsocket.on('message', (data: string) => {
42
+ const response = JSON.parse(data);
43
+ if (response.type === "openDebugBrowserResponse") {
44
+ resolve(response); // Resolve the Promise with the response data
45
+ }
46
+ })
47
+ })
48
+
29
49
  }
30
50
  }
31
51