Skip to content

Commit 69d0ee8

Browse files
changes
1 parent a31cbee commit 69d0ee8

File tree

3 files changed

+71
-4
lines changed

3 files changed

+71
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codebolt/codeboltjs",
3-
"version": "1.1.29",
3+
"version": "1.1.30",
44
"description": "",
55
"keywords": [],
66
"author": "",

src/modules/codeutils.ts

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,14 @@ const cbcodeutils = {
5151
});
5252
});
5353
},
54-
matchProblem:(matcherDefinition:object, problemPatterns:[], problems:[])=>{
54+
performMatch:(matcherDefinition:object, problemPatterns:[], problems:[])=>{
5555
return new Promise((resolve, reject) => {
5656
cbws.getWebsocket.send(JSON.stringify({
5757
"type": "codeEvent",
58-
"action":"getJsTree",
58+
"action":"performMatch",
5959
payload:{
6060
matcherDefinition,
6161
problemPatterns,
62-
problems
6362
}
6463
}));
6564
cbws.getWebsocket.on('message', (data: string) => {
@@ -69,7 +68,41 @@ const cbcodeutils = {
6968
}
7069
});
7170
});
71+
},
72+
getMatcherList:()=>{
73+
return new Promise((resolve, reject) => {
74+
cbws.getWebsocket.send(JSON.stringify({
75+
"type": "codeEvent",
76+
"action":"getMatcherList",
77+
78+
}));
79+
cbws.getWebsocket.on('message', (data: string) => {
80+
const response = JSON.parse(data);
81+
if (response.type === "getMatcherListTreeResponse") {
82+
resolve(resolve); // Resolve the Promise with the response data
83+
}
84+
});
85+
});
86+
},
87+
matchDetail:(matcher:string)=>{
88+
return new Promise((resolve, reject) => {
89+
cbws.getWebsocket.send(JSON.stringify({
90+
"type": "codeEvent",
91+
"action":"getMatchDetail",
92+
payload:{
93+
match:matcher
94+
}
95+
96+
}));
97+
cbws.getWebsocket.on('message', (data: string) => {
98+
const response = JSON.parse(data);
99+
if (response.type === "matchDetailTreeResponse") {
100+
resolve(resolve); // Resolve the Promise with the response data
101+
}
102+
});
103+
});
72104
}
105+
73106
};
74107

75108
export default cbcodeutils;

src/modules/state.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,40 @@ const cbstate = {
1818
}
1919
});
2020
});
21+
},
22+
addToAgentState: async (key: string, value: string): Promise<void> => {
23+
return new Promise((resolve, reject) => {
24+
cbws.getWebsocket.send(JSON.stringify({
25+
"type": "agentStateEvent",
26+
"action":"addToAgentState",
27+
payload:{
28+
key,
29+
value
30+
}
31+
32+
}));
33+
cbws.getWebsocket.on('message', (data: string) => {
34+
const response = JSON.parse(data);
35+
if (response.type === "addToAgentStateResponse") {
36+
resolve(response); // Resolve the Promise with the response data
37+
}
38+
});
39+
});
40+
},
41+
getAgentState: async (): Promise<any> => {
42+
return new Promise((resolve, reject) => {
43+
cbws.getWebsocket.send(JSON.stringify({
44+
"type": "agentStateEvent",
45+
"action":"getAgentState",
46+
47+
}));
48+
cbws.getWebsocket.on('message', (data: string) => {
49+
const response = JSON.parse(data);
50+
if (response.type === "getAgentStateResponse") {
51+
resolve(response); // Resolve the Promise with the response data
52+
}
53+
});
54+
});
2155
}
2256
};
2357

0 commit comments

Comments
 (0)