@codebolt/codeboltjs 1.1.86 → 1.1.88

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.
@@ -0,0 +1 @@
1
+ []
@@ -0,0 +1 @@
1
+ []
@@ -0,0 +1,127 @@
1
+ {
2
+ "0": "{",
3
+ "1": "\n",
4
+ "2": " ",
5
+ "3": " ",
6
+ "4": "\"",
7
+ "5": "a",
8
+ "6": "c",
9
+ "7": "t",
10
+ "8": "i",
11
+ "9": "v",
12
+ "10": "e",
13
+ "11": "A",
14
+ "12": "g",
15
+ "13": "e",
16
+ "14": "n",
17
+ "15": "t",
18
+ "16": "\"",
19
+ "17": ":",
20
+ "18": " ",
21
+ "19": "f",
22
+ "20": "a",
23
+ "21": "l",
24
+ "22": "s",
25
+ "23": "e",
26
+ "24": ",",
27
+ "25": "\n",
28
+ "26": " ",
29
+ "27": " ",
30
+ "28": "\"",
31
+ "29": "p",
32
+ "30": "i",
33
+ "31": "n",
34
+ "32": "n",
35
+ "33": "e",
36
+ "34": "d",
37
+ "35": "A",
38
+ "36": "g",
39
+ "37": "e",
40
+ "38": "n",
41
+ "39": "t",
42
+ "40": "\"",
43
+ "41": ":",
44
+ "42": " ",
45
+ "43": "[",
46
+ "44": "]",
47
+ "45": "\n",
48
+ "46": "}",
49
+ "currentLayout": {
50
+ "grid": {
51
+ "root": {
52
+ "type": "branch",
53
+ "data": [
54
+ {
55
+ "type": "leaf",
56
+ "data": {
57
+ "views": [
58
+ "Code"
59
+ ],
60
+ "activeView": "Code",
61
+ "id": "1"
62
+ },
63
+ "size": 735
64
+ },
65
+ {
66
+ "type": "branch",
67
+ "data": [
68
+ {
69
+ "type": "leaf",
70
+ "data": {
71
+ "views": [
72
+ "Chat"
73
+ ],
74
+ "activeView": "Chat",
75
+ "id": "2"
76
+ },
77
+ "size": 577
78
+ },
79
+ {
80
+ "type": "leaf",
81
+ "data": {
82
+ "views": [
83
+ "Preview"
84
+ ],
85
+ "activeView": "Preview",
86
+ "id": "3"
87
+ },
88
+ "size": 283
89
+ }
90
+ ],
91
+ "size": 735
92
+ }
93
+ ],
94
+ "size": 860
95
+ },
96
+ "width": 1470,
97
+ "height": 860,
98
+ "orientation": "HORIZONTAL"
99
+ },
100
+ "panels": {
101
+ "Code": {
102
+ "id": "Code",
103
+ "contentComponent": "Code",
104
+ "tabComponent": "props.defaultTabComponent",
105
+ "title": "Code",
106
+ "renderer": "always"
107
+ },
108
+ "Chat": {
109
+ "id": "Chat",
110
+ "contentComponent": "Chat",
111
+ "tabComponent": "props.defaultTabComponent",
112
+ "title": "Chat",
113
+ "renderer": "always"
114
+ },
115
+ "Preview": {
116
+ "id": "Preview",
117
+ "contentComponent": "Preview",
118
+ "tabComponent": "props.defaultTabComponent",
119
+ "title": "Preview",
120
+ "renderer": "always"
121
+ }
122
+ },
123
+ "activeGroup": "1"
124
+ },
125
+ "pinnedAgent": [],
126
+ "activeAgent": false
127
+ }
@@ -0,0 +1 @@
1
+ []
package/index.d.ts CHANGED
@@ -201,6 +201,8 @@ declare class Codebolt {
201
201
  getApplicationState: () => Promise<import("@codebolt/types").ApplicationState>;
202
202
  addToAgentState: (key: string, value: string) => Promise<import("@codebolt/types").AddToAgentStateResponse>;
203
203
  getAgentState: () => Promise<import("@codebolt/types").GetAgentStateResponse>;
204
+ getProjectState: () => Promise<any>;
205
+ updateProjectState: (key: string, value: any) => Promise<any>;
204
206
  };
205
207
  taskplaner: {
206
208
  addTask: (task: string) => Promise<any>;
@@ -17,5 +17,15 @@ declare const cbstate: {
17
17
  * @returns {Promise<GetAgentStateResponse>} A promise that resolves with the agent's state.
18
18
  */
19
19
  getAgentState: () => Promise<GetAgentStateResponse>;
20
+ /**
21
+ * Retrieves the current project state from the server via WebSocket.
22
+ * @returns {Promise<GetProjectStateResponse>} A promise that resolves with the project's state.
23
+ */
24
+ getProjectState: () => Promise<any>;
25
+ /**
26
+ * Updates the project state on the server via WebSocket.
27
+ * @returns {Promise<UpdateProjectStateResponse>} A promise that resolves with the response to the update request.
28
+ */
29
+ updateProjectState: (key: string, value: any) => Promise<any>;
20
30
  };
21
31
  export default cbstate;
package/modules/state.js CHANGED
@@ -12,7 +12,8 @@ const cbstate = {
12
12
  getApplicationState: async () => {
13
13
  return new Promise((resolve, reject) => {
14
14
  websocket_1.default.getWebsocket.send(JSON.stringify({
15
- "type": "getAppState",
15
+ "type": "projectStateEvent",
16
+ "action": "getAppState",
16
17
  }));
17
18
  websocket_1.default.getWebsocket.on('message', (data) => {
18
19
  const response = JSON.parse(data);
@@ -63,6 +64,46 @@ const cbstate = {
63
64
  }
64
65
  });
65
66
  });
67
+ },
68
+ /**
69
+ * Retrieves the current project state from the server via WebSocket.
70
+ * @returns {Promise<GetProjectStateResponse>} A promise that resolves with the project's state.
71
+ */
72
+ getProjectState: async () => {
73
+ return new Promise((resolve, reject) => {
74
+ websocket_1.default.getWebsocket.send(JSON.stringify({
75
+ "type": "projectStateEvent",
76
+ "action": "getProjectState",
77
+ }));
78
+ websocket_1.default.getWebsocket.on('message', (data) => {
79
+ const response = JSON.parse(data);
80
+ if (response.type === "getProjectStateResponse") {
81
+ resolve(response); // Resolve the Promise with the response data
82
+ }
83
+ });
84
+ });
85
+ },
86
+ /**
87
+ * Updates the project state on the server via WebSocket.
88
+ * @returns {Promise<UpdateProjectStateResponse>} A promise that resolves with the response to the update request.
89
+ */
90
+ updateProjectState: async (key, value) => {
91
+ return new Promise((resolve, reject) => {
92
+ websocket_1.default.getWebsocket.send(JSON.stringify({
93
+ "type": "projectStateEvent",
94
+ "action": "updateProjectState",
95
+ payload: {
96
+ key,
97
+ value
98
+ }
99
+ }));
100
+ websocket_1.default.getWebsocket.on('message', (data) => {
101
+ const response = JSON.parse(data);
102
+ if (response.type === "updateProjectStateResponse") {
103
+ resolve(response); // Resolve the Promise with the response data
104
+ }
105
+ });
106
+ });
66
107
  }
67
108
  };
68
109
  exports.default = cbstate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.86",
3
+ "version": "1.1.88",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -9,7 +9,8 @@ const cbstate = {
9
9
  getApplicationState: async (): Promise<ApplicationState> => {
10
10
  return new Promise((resolve, reject) => {
11
11
  cbws.getWebsocket.send(JSON.stringify({
12
- "type": "getAppState",
12
+ "type": "projectStateEvent",
13
+ "action": "getAppState",
13
14
 
14
15
  }));
15
16
  cbws.getWebsocket.on('message', (data: string) => {
@@ -63,7 +64,52 @@ const cbstate = {
63
64
  }
64
65
  });
65
66
  });
67
+ },
68
+
69
+
70
+ /**
71
+ * Retrieves the current project state from the server via WebSocket.
72
+ * @returns {Promise<GetProjectStateResponse>} A promise that resolves with the project's state.
73
+ */
74
+ getProjectState: async (): Promise<any> => {
75
+ return new Promise((resolve, reject) => {
76
+ cbws.getWebsocket.send(JSON.stringify({
77
+ "type": "projectStateEvent",
78
+ "action": "getProjectState",
79
+ }));
80
+ cbws.getWebsocket.on('message', (data: string) => {
81
+ const response = JSON.parse(data);
82
+ if (response.type === "getProjectStateResponse") {
83
+ resolve(response); // Resolve the Promise with the response data
84
+ }
85
+ });
86
+ });
87
+ },
88
+
89
+ /**
90
+ * Updates the project state on the server via WebSocket.
91
+ * @returns {Promise<UpdateProjectStateResponse>} A promise that resolves with the response to the update request.
92
+ */
93
+ updateProjectState: async (key:string,value:any): Promise<any> => {
94
+ return new Promise((resolve, reject) => {
95
+ cbws.getWebsocket.send(JSON.stringify({
96
+ "type": "projectStateEvent",
97
+ "action": "updateProjectState",
98
+ payload:{
99
+ key,
100
+ value
101
+ }
102
+ }));
103
+ cbws.getWebsocket.on('message', (data: string) => {
104
+ const response = JSON.parse(data);
105
+ if (response.type === "updateProjectStateResponse") {
106
+ resolve(response); // Resolve the Promise with the response data
107
+ }
108
+ });
109
+ });
66
110
  }
111
+
112
+
67
113
  };
68
114
 
69
115
  export default cbstate;