@codebolt/codeboltjs 1.1.45 → 1.1.47

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
@@ -108,6 +108,7 @@ declare class Codebolt {
108
108
  };
109
109
  stopProcess: () => void;
110
110
  sendConfirmationRequest: (confirmationMessage: string, buttons?: string[]) => Promise<string>;
111
+ sendNotificationEvent: (notificationMessage: string, type: "debug" | "git" | "planner" | "browser" | "editor" | "terminal" | "preview") => void;
111
112
  };
112
113
  terminal: {
113
114
  eventEmitter: {
package/modules/chat.d.ts CHANGED
@@ -49,5 +49,10 @@ declare const cbchat: {
49
49
  * @returns {Promise<string>} A promise that resolves with the server's response.
50
50
  */
51
51
  sendConfirmationRequest: (confirmationMessage: string, buttons?: string[]) => Promise<string>;
52
+ /**
53
+ * Sends a notification event to the server.
54
+ * @param {string} notificationMessage - The message to be sent in the notification.
55
+ */
56
+ sendNotificationEvent: (notificationMessage: string, type: 'debug' | 'git' | 'planner' | 'browser' | 'editor' | 'terminal' | 'preview') => void;
52
57
  };
53
58
  export default cbchat;
package/modules/chat.js CHANGED
@@ -140,10 +140,21 @@ const cbchat = {
140
140
  websocket_1.default.getWebsocket.on('message', (data) => {
141
141
  const response = JSON.parse(data);
142
142
  if (response.type === "confirmationResponse") {
143
- resolve(response.answer); // Resolve the Promise with the server's response
143
+ resolve(response); // Resolve the Promise with the server's response
144
144
  }
145
145
  });
146
146
  });
147
- }
147
+ },
148
+ /**
149
+ * Sends a notification event to the server.
150
+ * @param {string} notificationMessage - The message to be sent in the notification.
151
+ */
152
+ sendNotificationEvent: (notificationMessage, type) => {
153
+ websocket_1.default.getWebsocket.send(JSON.stringify({
154
+ "type": "notificationEvent",
155
+ "message": notificationMessage,
156
+ "eventType": type
157
+ }));
158
+ },
148
159
  };
149
160
  exports.default = cbchat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.45",
3
+ "version": "1.1.47",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -146,11 +146,23 @@ const cbchat = {
146
146
  cbws.getWebsocket.on('message', (data: string) => {
147
147
  const response = JSON.parse(data);
148
148
  if (response.type === "confirmationResponse") {
149
- resolve(response.answer); // Resolve the Promise with the server's response
149
+ resolve(response); // Resolve the Promise with the server's response
150
150
  }
151
151
  });
152
152
  });
153
- }
153
+ },
154
+ /**
155
+ * Sends a notification event to the server.
156
+ * @param {string} notificationMessage - The message to be sent in the notification.
157
+ */
158
+ sendNotificationEvent: (notificationMessage: string, type: 'debug' | 'git' | 'planner' | 'browser' | 'editor' | 'terminal' | 'preview'): void => {
159
+ cbws.getWebsocket.send(JSON.stringify({
160
+ "type": "notificationEvent",
161
+ "message": notificationMessage,
162
+ "eventType":type
163
+ }));
164
+ },
165
+
154
166
  };
155
167
 
156
168
  export default cbchat;