@codebolt/codeboltjs 1.1.37 → 1.1.39

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
@@ -25,7 +25,7 @@ declare class Codebolt {
25
25
  updateFile: (filename: string, filePath: string, newContent: string) => Promise<import("@codebolt/types").UpdateFileResponse>;
26
26
  deleteFile: (filename: string, filePath: string) => Promise<import("@codebolt/types").DeleteFileResponse>;
27
27
  deleteFolder: (foldername: string, folderpath: string) => Promise<import("@codebolt/types").DeleteFolderResponse>;
28
- listFile: (filePath: string) => Promise<unknown>;
28
+ listFile: (folderPath: string, isRecursive?: boolean) => Promise<unknown>;
29
29
  };
30
30
  git: {
31
31
  init: (path: string) => Promise<any>;
@@ -53,6 +53,8 @@ declare class Codebolt {
53
53
  getPDF: () => void;
54
54
  pdfToText: () => void;
55
55
  getContent: () => Promise<import("@codebolt/types").GetContentResponse>;
56
+ getSnapShot: () => Promise<any>;
57
+ getBrowserInfo: () => Promise<any>;
56
58
  extractText: () => Promise<import("@codebolt/types").ExtractTextResponse>;
57
59
  close: () => void;
58
60
  scroll: (direction: string, pixels: string) => Promise<unknown>;
@@ -46,6 +46,16 @@ declare const cbbrowser: {
46
46
  * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
47
47
  */
48
48
  getContent: () => Promise<GetContentResponse>;
49
+ /**
50
+ * Retrieves the snapshot of the current page.
51
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
52
+ */
53
+ getSnapShot: () => Promise<any>;
54
+ /**
55
+ * Retrieves browser info like height width scrollx scrolly of the current page.
56
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
57
+ */
58
+ getBrowserInfo: () => Promise<any>;
49
59
  /**
50
60
  * Extracts text from the current page.
51
61
  * @returns {Promise<ExtractTextResponse>} A promise that resolves with the extracted text.
@@ -145,6 +145,42 @@ const cbbrowser = {
145
145
  });
146
146
  });
147
147
  },
148
+ /**
149
+ * Retrieves the snapshot of the current page.
150
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
151
+ */
152
+ getSnapShot: () => {
153
+ return new Promise((resolve, reject) => {
154
+ websocket_1.default.getWebsocket.send(JSON.stringify({
155
+ "type": "browserEvent",
156
+ action: 'getSnapShot'
157
+ }));
158
+ websocket_1.default.getWebsocket.on('message', (data) => {
159
+ const response = JSON.parse(data);
160
+ if (response.event === "getSnapShotResponse") {
161
+ resolve(response);
162
+ }
163
+ });
164
+ });
165
+ },
166
+ /**
167
+ * Retrieves browser info like height width scrollx scrolly of the current page.
168
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
169
+ */
170
+ getBrowserInfo: () => {
171
+ return new Promise((resolve, reject) => {
172
+ websocket_1.default.getWebsocket.send(JSON.stringify({
173
+ "type": "browserEvent",
174
+ action: 'getBrowserInfo'
175
+ }));
176
+ websocket_1.default.getWebsocket.on('message', (data) => {
177
+ const response = JSON.parse(data);
178
+ if (response.event === "getBrowserInfoResponse") {
179
+ resolve(response);
180
+ }
181
+ });
182
+ });
183
+ },
148
184
  /**
149
185
  * Extracts text from the current page.
150
186
  * @returns {Promise<ExtractTextResponse>} A promise that resolves with the extracted text.
package/modules/chat.d.ts CHANGED
@@ -28,7 +28,7 @@ declare const cbchat: {
28
28
  /**
29
29
  * Waits for a reply to a sent message.
30
30
  * @param {string} message - The message for which a reply is expected.
31
- * @returns {Promise<string>} A promise that resolves with the reply.
31
+ * @returns {Promise<ChatMessage>} A promise that resolves with the reply.
32
32
  */
33
33
  waitforReply: (message: string) => Promise<string>;
34
34
  /**
package/modules/chat.js CHANGED
@@ -62,7 +62,7 @@ const cbchat = {
62
62
  /**
63
63
  * Waits for a reply to a sent message.
64
64
  * @param {string} message - The message for which a reply is expected.
65
- * @returns {Promise<string>} A promise that resolves with the reply.
65
+ * @returns {Promise<ChatMessage>} A promise that resolves with the reply.
66
66
  */
67
67
  waitforReply: (message) => {
68
68
  return new Promise((resolve, reject) => {
package/modules/fs.d.ts CHANGED
@@ -59,6 +59,6 @@ declare const cbfs: {
59
59
  * @description Lists all files.
60
60
  * @returns {Promise<FileListResponse>} A promise that resolves with the list of files.
61
61
  */
62
- listFile: (filePath: string) => Promise<unknown>;
62
+ listFile: (folderPath: string, isRecursive?: boolean) => Promise<unknown>;
63
63
  };
64
64
  export default cbfs;
package/modules/fs.js CHANGED
@@ -168,11 +168,15 @@ const cbfs = {
168
168
  * @description Lists all files.
169
169
  * @returns {Promise<FileListResponse>} A promise that resolves with the list of files.
170
170
  */
171
- listFile: (filePath) => {
171
+ listFile: (folderPath, isRecursive = false) => {
172
172
  return new Promise((resolve, reject) => {
173
173
  websocket_1.default.getWebsocket.send(JSON.stringify({
174
174
  "type": "fsEvent",
175
175
  "action": "fileList",
176
+ message: {
177
+ folderPath,
178
+ isRecursive
179
+ }
176
180
  }));
177
181
  websocket_1.default.getWebsocket.on('message', (data) => {
178
182
  const response = JSON.parse(data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "1.1.37",
3
+ "version": "1.1.39",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -152,6 +152,44 @@ const cbbrowser = {
152
152
  });
153
153
  });
154
154
  },
155
+ /**
156
+ * Retrieves the snapshot of the current page.
157
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
158
+ */
159
+ getSnapShot: ():Promise<any> => {
160
+
161
+ return new Promise((resolve, reject) => {
162
+ cbws.getWebsocket.send(JSON.stringify({
163
+ "type": "browserEvent",
164
+ action: 'getSnapShot'
165
+ }));
166
+ cbws.getWebsocket.on('message', (data: string) => {
167
+ const response = JSON.parse(data);
168
+ if (response.event === "getSnapShotResponse") {
169
+ resolve(response);
170
+ }
171
+ });
172
+ });
173
+ },
174
+ /**
175
+ * Retrieves browser info like height width scrollx scrolly of the current page.
176
+ * @returns {Promise<GetContentResponse>} A promise that resolves with the content.
177
+ */
178
+ getBrowserInfo: ():Promise<any> => {
179
+
180
+ return new Promise((resolve, reject) => {
181
+ cbws.getWebsocket.send(JSON.stringify({
182
+ "type": "browserEvent",
183
+ action: 'getBrowserInfo'
184
+ }));
185
+ cbws.getWebsocket.on('message', (data: string) => {
186
+ const response = JSON.parse(data);
187
+ if (response.event === "getBrowserInfoResponse") {
188
+ resolve(response);
189
+ }
190
+ });
191
+ });
192
+ },
155
193
 
156
194
  /**
157
195
  * Extracts text from the current page.
@@ -63,7 +63,7 @@ const cbchat = {
63
63
  /**
64
64
  * Waits for a reply to a sent message.
65
65
  * @param {string} message - The message for which a reply is expected.
66
- * @returns {Promise<string>} A promise that resolves with the reply.
66
+ * @returns {Promise<ChatMessage>} A promise that resolves with the reply.
67
67
  */
68
68
  waitforReply: (message: string): Promise<string> => {
69
69
  return new Promise((resolve, reject) => {
package/src/modules/fs.ts CHANGED
@@ -164,12 +164,15 @@ const cbfs = {
164
164
  * @description Lists all files.
165
165
  * @returns {Promise<FileListResponse>} A promise that resolves with the list of files.
166
166
  */
167
- listFile: (filePath:string) => {
167
+ listFile: (folderPath:string,isRecursive=false) => {
168
168
  return new Promise((resolve, reject) => {
169
169
  cbws.getWebsocket.send(JSON.stringify({
170
170
  "type": "fsEvent",
171
171
  "action": "fileList",
172
-
172
+ message:{
173
+ folderPath,
174
+ isRecursive
175
+ }
173
176
  }));
174
177
  cbws.getWebsocket.on('message', (data: string) => {
175
178
  const response = JSON.parse(data);