@codebolt/codeboltjs 1.1.26 → 1.1.28
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 +5 -1
- package/modules/chat.d.ts +1 -0
- package/modules/chat.js +8 -0
- package/modules/codeutils.d.ts +3 -8
- package/modules/codeutils.js +47 -9
- package/modules/debug.d.ts +1 -0
- package/modules/debug.js +19 -0
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/modules/chat.ts +8 -0
- package/src/modules/codeutils.ts +49 -9
- package/src/modules/debug.ts +20 -0
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,8 +96,10 @@ declare class Codebolt {
|
|
|
95
96
|
executeCommandWithStream(command: string): import("./modules/terminal").CustomEventEmitter;
|
|
96
97
|
};
|
|
97
98
|
codeutils: {
|
|
98
|
-
getCodeTree: (
|
|
99
|
+
getCodeTree: () => Promise<any>;
|
|
100
|
+
getJsTree: (filePath: string) => Promise<any>;
|
|
99
101
|
getAllFilesAsMarkDown: () => Promise<unknown>;
|
|
102
|
+
matchProblem: (matcherDefinition: object, problemPatterns: [], problems: []) => Promise<unknown>;
|
|
100
103
|
};
|
|
101
104
|
docutils: {
|
|
102
105
|
pdf_to_text: (pdf_path: any) => Promise<string>;
|
|
@@ -155,6 +158,7 @@ declare class Codebolt {
|
|
|
155
158
|
};
|
|
156
159
|
debug: {
|
|
157
160
|
debug(log: string, type: import("./modules/debug").logType): Promise<unknown>;
|
|
161
|
+
openDebugBrowser(url: string, port: number): Promise<unknown>;
|
|
158
162
|
};
|
|
159
163
|
tokenizer: {
|
|
160
164
|
addToken: (key: string) => Promise<any>;
|
package/modules/chat.d.ts
CHANGED
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;
|
package/modules/codeutils.d.ts
CHANGED
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
* A utility module for working with code.
|
|
3
3
|
*/
|
|
4
4
|
declare const cbcodeutils: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @param {any} fileName - The name of the file.
|
|
8
|
-
* @param {any} source - The source code to generate the tree from.
|
|
9
|
-
* @param {any} filePath - The file path where the source code is located.
|
|
10
|
-
* @returns {Promise<any>} A promise that resolves with the code tree.
|
|
11
|
-
*/
|
|
12
|
-
getCodeTree: (fileName: any, source: any, filePath: any) => Promise<any>;
|
|
5
|
+
getCodeTree: () => Promise<any>;
|
|
6
|
+
getJsTree: (filePath: string) => Promise<any>;
|
|
13
7
|
getAllFilesAsMarkDown: () => Promise<unknown>;
|
|
8
|
+
matchProblem: (matcherDefinition: object, problemPatterns: [], problems: []) => Promise<unknown>;
|
|
14
9
|
};
|
|
15
10
|
export default cbcodeutils;
|
package/modules/codeutils.js
CHANGED
|
@@ -8,16 +8,35 @@ const websocket_1 = __importDefault(require("./websocket"));
|
|
|
8
8
|
* A utility module for working with code.
|
|
9
9
|
*/
|
|
10
10
|
const cbcodeutils = {
|
|
11
|
-
|
|
12
|
-
* Asynchronously generates a code tree from the provided source code.
|
|
13
|
-
* @param {any} fileName - The name of the file.
|
|
14
|
-
* @param {any} source - The source code to generate the tree from.
|
|
15
|
-
* @param {any} filePath - The file path where the source code is located.
|
|
16
|
-
* @returns {Promise<any>} A promise that resolves with the code tree.
|
|
17
|
-
*/
|
|
18
|
-
getCodeTree: (fileName, source, filePath) => {
|
|
11
|
+
getCodeTree: () => {
|
|
19
12
|
return new Promise((resolve, reject) => {
|
|
20
|
-
|
|
13
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
14
|
+
"type": "codeEvent",
|
|
15
|
+
"action": "getCodeTree"
|
|
16
|
+
}));
|
|
17
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
18
|
+
const response = JSON.parse(data);
|
|
19
|
+
if (response.type === "getCodeTreeResponse") {
|
|
20
|
+
resolve(response.markdown); // Resolve the Promise with the response data
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
getJsTree: (filePath) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
28
|
+
"type": "codeEvent",
|
|
29
|
+
"action": "getJsTree",
|
|
30
|
+
payload: {
|
|
31
|
+
filePath
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
35
|
+
const response = JSON.parse(data);
|
|
36
|
+
if (response.type === "getgetJsTreeResponse") {
|
|
37
|
+
resolve(response.payload); // Resolve the Promise with the response data
|
|
38
|
+
}
|
|
39
|
+
});
|
|
21
40
|
});
|
|
22
41
|
},
|
|
23
42
|
getAllFilesAsMarkDown: () => {
|
|
@@ -33,6 +52,25 @@ const cbcodeutils = {
|
|
|
33
52
|
}
|
|
34
53
|
});
|
|
35
54
|
});
|
|
55
|
+
},
|
|
56
|
+
matchProblem: (matcherDefinition, problemPatterns, problems) => {
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
59
|
+
"type": "codeEvent",
|
|
60
|
+
"action": "getJsTree",
|
|
61
|
+
payload: {
|
|
62
|
+
matcherDefinition,
|
|
63
|
+
problemPatterns,
|
|
64
|
+
problems
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
68
|
+
const response = JSON.parse(data);
|
|
69
|
+
if (response.type === "getgetJsTreeResponse") {
|
|
70
|
+
resolve(response.payload); // Resolve the Promise with the response data
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
36
74
|
}
|
|
37
75
|
};
|
|
38
76
|
exports.default = cbcodeutils;
|
package/modules/debug.d.ts
CHANGED
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
package/src/index.ts
CHANGED
package/src/modules/chat.ts
CHANGED
|
@@ -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
|
|
package/src/modules/codeutils.ts
CHANGED
|
@@ -4,16 +4,37 @@ import cbws from './websocket';
|
|
|
4
4
|
* A utility module for working with code.
|
|
5
5
|
*/
|
|
6
6
|
const cbcodeutils = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* @param {any} source - The source code to generate the tree from.
|
|
11
|
-
* @param {any} filePath - The file path where the source code is located.
|
|
12
|
-
* @returns {Promise<any>} A promise that resolves with the code tree.
|
|
13
|
-
*/
|
|
14
|
-
getCodeTree: (fileName: any, source: any, filePath: any): Promise<any> => {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
getCodeTree: (): Promise<any> => {
|
|
15
10
|
return new Promise((resolve, reject) => {
|
|
16
|
-
|
|
11
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
12
|
+
"type": "codeEvent",
|
|
13
|
+
"action":"getCodeTree"
|
|
14
|
+
}));
|
|
15
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
16
|
+
const response = JSON.parse(data);
|
|
17
|
+
if (response.type === "getCodeTreeResponse") {
|
|
18
|
+
resolve(response.markdown); // Resolve the Promise with the response data
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
getJsTree: (filePath:string): Promise<any> => {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
26
|
+
"type": "codeEvent",
|
|
27
|
+
"action":"getJsTree",
|
|
28
|
+
payload:{
|
|
29
|
+
filePath
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
33
|
+
const response = JSON.parse(data);
|
|
34
|
+
if (response.type === "getgetJsTreeResponse") {
|
|
35
|
+
resolve(response.payload); // Resolve the Promise with the response data
|
|
36
|
+
}
|
|
37
|
+
});
|
|
17
38
|
});
|
|
18
39
|
},
|
|
19
40
|
getAllFilesAsMarkDown:()=>{
|
|
@@ -29,6 +50,25 @@ const cbcodeutils = {
|
|
|
29
50
|
}
|
|
30
51
|
});
|
|
31
52
|
});
|
|
53
|
+
},
|
|
54
|
+
matchProblem:(matcherDefinition:object, problemPatterns:[], problems:[])=>{
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
57
|
+
"type": "codeEvent",
|
|
58
|
+
"action":"getJsTree",
|
|
59
|
+
payload:{
|
|
60
|
+
matcherDefinition,
|
|
61
|
+
problemPatterns,
|
|
62
|
+
problems
|
|
63
|
+
}
|
|
64
|
+
}));
|
|
65
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
66
|
+
const response = JSON.parse(data);
|
|
67
|
+
if (response.type === "getgetJsTreeResponse") {
|
|
68
|
+
resolve(response.payload); // Resolve the Promise with the response data
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
32
72
|
}
|
|
33
73
|
};
|
|
34
74
|
|
package/src/modules/debug.ts
CHANGED
|
@@ -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
|
|