@codebolt/codeboltjs 1.1.42 → 1.1.44

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
@@ -107,6 +107,7 @@ declare class Codebolt {
107
107
  stopProcess: () => void;
108
108
  };
109
109
  stopProcess: () => void;
110
+ sendConfirmationRequest: (confirmationMessage: string) => Promise<string>;
110
111
  };
111
112
  terminal: {
112
113
  eventEmitter: {
package/modules/chat.d.ts CHANGED
@@ -44,5 +44,10 @@ declare const cbchat: {
44
44
  * Sends a specific message to the server to stop the process.
45
45
  */
46
46
  stopProcess: () => void;
47
+ /**
48
+ * Sends a confirmation request to the server with two options: Yes or No.
49
+ * @returns {Promise<string>} A promise that resolves with the server's response.
50
+ */
51
+ sendConfirmationRequest: (confirmationMessage: string) => Promise<string>;
47
52
  };
48
53
  export default cbchat;
package/modules/chat.js CHANGED
@@ -78,7 +78,7 @@ const cbchat = {
78
78
  }));
79
79
  websocket_1.default.getWebsocket.on('message', (data) => {
80
80
  const response = JSON.parse(data);
81
- if (response.type === "messageResponse") {
81
+ if (response.type === "waitFormessageResponse") {
82
82
  resolve(response); // Resolve the Promise with the response data
83
83
  }
84
84
  });
@@ -125,6 +125,24 @@ const cbchat = {
125
125
  websocket_1.default.getWebsocket.send(JSON.stringify({
126
126
  "type": "processStoped"
127
127
  }));
128
+ },
129
+ /**
130
+ * Sends a confirmation request to the server with two options: Yes or No.
131
+ * @returns {Promise<string>} A promise that resolves with the server's response.
132
+ */
133
+ sendConfirmationRequest: (confirmationMessage) => {
134
+ return new Promise((resolve, reject) => {
135
+ websocket_1.default.getWebsocket.send(JSON.stringify({
136
+ "type": "confirmationRequest",
137
+ "message": confirmationMessage
138
+ }));
139
+ websocket_1.default.getWebsocket.on('message', (data) => {
140
+ const response = JSON.parse(data);
141
+ if (response.type === "confirmationResponse") {
142
+ resolve(response.answer); // Resolve the Promise with the server's response
143
+ }
144
+ });
145
+ });
128
146
  }
129
147
  };
130
148
  exports.default = cbchat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.42",
3
+ "version": "1.1.44",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -79,7 +79,7 @@ const cbchat = {
79
79
  }));
80
80
  cbws.getWebsocket.on('message', (data: string) => {
81
81
  const response = JSON.parse(data);
82
- if (response.type === "messageResponse") {
82
+ if (response.type === "waitFormessageResponse") {
83
83
  resolve(response); // Resolve the Promise with the response data
84
84
  }
85
85
  });
@@ -129,6 +129,25 @@ const cbchat = {
129
129
  cbws.getWebsocket.send(JSON.stringify({
130
130
  "type": "processStoped"
131
131
  }));
132
+ },
133
+
134
+ /**
135
+ * Sends a confirmation request to the server with two options: Yes or No.
136
+ * @returns {Promise<string>} A promise that resolves with the server's response.
137
+ */
138
+ sendConfirmationRequest: (confirmationMessage: string): Promise<string> => {
139
+ return new Promise((resolve, reject) => {
140
+ cbws.getWebsocket.send(JSON.stringify({
141
+ "type": "confirmationRequest",
142
+ "message": confirmationMessage
143
+ }));
144
+ cbws.getWebsocket.on('message', (data: string) => {
145
+ const response = JSON.parse(data);
146
+ if (response.type === "confirmationResponse") {
147
+ resolve(response.answer); // Resolve the Promise with the server's response
148
+ }
149
+ });
150
+ });
132
151
  }
133
152
  };
134
153