@codebolt/codeboltjs 1.1.64 → 1.1.66
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 +9 -1
- package/modules/chat.d.ts +1 -1
- package/modules/chat.js +4 -3
- package/modules/fs.d.ts +22 -0
- package/modules/fs.js +50 -0
- package/package.json +1 -1
- package/src/modules/chat.ts +4 -3
- package/src/modules/fs.ts +51 -0
package/index.d.ts
CHANGED
|
@@ -26,6 +26,14 @@ declare class Codebolt {
|
|
|
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
28
|
listFile: (folderPath: string, isRecursive?: boolean) => Promise<unknown>;
|
|
29
|
+
listCodeDefinitionNames: (path: string) => Promise<{
|
|
30
|
+
success: boolean;
|
|
31
|
+
result: any;
|
|
32
|
+
}>;
|
|
33
|
+
searchFiles: (path: string, regex: string, filePattern: string) => Promise<{
|
|
34
|
+
success: boolean;
|
|
35
|
+
result: any;
|
|
36
|
+
}>;
|
|
29
37
|
};
|
|
30
38
|
git: {
|
|
31
39
|
init: (path: string) => Promise<any>;
|
|
@@ -108,7 +116,7 @@ declare class Codebolt {
|
|
|
108
116
|
};
|
|
109
117
|
stopProcess: () => void;
|
|
110
118
|
processFinished: () => void;
|
|
111
|
-
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[]) => Promise<string>;
|
|
119
|
+
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
112
120
|
sendNotificationEvent: (notificationMessage: string, type: "debug" | "git" | "planner" | "browser" | "editor" | "terminal" | "preview") => void;
|
|
113
121
|
};
|
|
114
122
|
terminal: {
|
package/modules/chat.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ declare const cbchat: {
|
|
|
53
53
|
* Sends a confirmation request to the server with two options: Yes or No.
|
|
54
54
|
* @returns {Promise<string>} A promise that resolves with the server's response.
|
|
55
55
|
*/
|
|
56
|
-
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[]) => Promise<string>;
|
|
56
|
+
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
57
57
|
/**
|
|
58
58
|
* Sends a notification event to the server.
|
|
59
59
|
* @param {string} notificationMessage - The message to be sent in the notification.
|
package/modules/chat.js
CHANGED
|
@@ -143,16 +143,17 @@ const cbchat = {
|
|
|
143
143
|
* Sends a confirmation request to the server with two options: Yes or No.
|
|
144
144
|
* @returns {Promise<string>} A promise that resolves with the server's response.
|
|
145
145
|
*/
|
|
146
|
-
sendConfirmationRequest: (confirmationMessage, buttons = []) => {
|
|
146
|
+
sendConfirmationRequest: (confirmationMessage, buttons = [], withFeedback = false) => {
|
|
147
147
|
return new Promise((resolve, reject) => {
|
|
148
148
|
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
149
149
|
"type": "confirmationRequest",
|
|
150
150
|
"message": confirmationMessage,
|
|
151
|
-
buttons: buttons
|
|
151
|
+
buttons: buttons,
|
|
152
|
+
withFeedback
|
|
152
153
|
}));
|
|
153
154
|
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
154
155
|
const response = JSON.parse(data);
|
|
155
|
-
if (response.type === "confirmationResponse") {
|
|
156
|
+
if (response.type === "confirmationResponse" || response.type === "feedbackResponse") {
|
|
156
157
|
resolve(response); // Resolve the Promise with the server's response
|
|
157
158
|
}
|
|
158
159
|
});
|
package/modules/fs.d.ts
CHANGED
|
@@ -60,5 +60,27 @@ declare const cbfs: {
|
|
|
60
60
|
* @returns {Promise<FileListResponse>} A promise that resolves with the list of files.
|
|
61
61
|
*/
|
|
62
62
|
listFile: (folderPath: string, isRecursive?: boolean) => Promise<unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* @function listCodeDefinitionNames
|
|
65
|
+
* @description Lists all code definition names in a given path.
|
|
66
|
+
* @param {string} path - The path to search for code definitions.
|
|
67
|
+
* @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of code definition names.
|
|
68
|
+
*/
|
|
69
|
+
listCodeDefinitionNames: (path: string) => Promise<{
|
|
70
|
+
success: boolean;
|
|
71
|
+
result: any;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* @function searchFiles
|
|
75
|
+
* @description Searches files in a given path using a regex pattern.
|
|
76
|
+
* @param {string} path - The path to search within.
|
|
77
|
+
* @param {string} regex - The regex pattern to search for.
|
|
78
|
+
* @param {string} filePattern - The file pattern to match files.
|
|
79
|
+
* @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
|
|
80
|
+
*/
|
|
81
|
+
searchFiles: (path: string, regex: string, filePattern: string) => Promise<{
|
|
82
|
+
success: boolean;
|
|
83
|
+
result: any;
|
|
84
|
+
}>;
|
|
63
85
|
};
|
|
64
86
|
export default cbfs;
|
package/modules/fs.js
CHANGED
|
@@ -186,5 +186,55 @@ const cbfs = {
|
|
|
186
186
|
});
|
|
187
187
|
});
|
|
188
188
|
},
|
|
189
|
+
/**
|
|
190
|
+
* @function listCodeDefinitionNames
|
|
191
|
+
* @description Lists all code definition names in a given path.
|
|
192
|
+
* @param {string} path - The path to search for code definitions.
|
|
193
|
+
* @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of code definition names.
|
|
194
|
+
*/
|
|
195
|
+
listCodeDefinitionNames: (path) => {
|
|
196
|
+
return new Promise((resolve, reject) => {
|
|
197
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
198
|
+
"type": "fsEvent",
|
|
199
|
+
"action": "listCodeDefinitionNames",
|
|
200
|
+
"message": {
|
|
201
|
+
path
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
205
|
+
const response = JSON.parse(data);
|
|
206
|
+
if (response.type === "listCodeDefinitionNamesResponse") {
|
|
207
|
+
resolve(response);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
/**
|
|
213
|
+
* @function searchFiles
|
|
214
|
+
* @description Searches files in a given path using a regex pattern.
|
|
215
|
+
* @param {string} path - The path to search within.
|
|
216
|
+
* @param {string} regex - The regex pattern to search for.
|
|
217
|
+
* @param {string} filePattern - The file pattern to match files.
|
|
218
|
+
* @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
|
|
219
|
+
*/
|
|
220
|
+
searchFiles: (path, regex, filePattern) => {
|
|
221
|
+
return new Promise((resolve, reject) => {
|
|
222
|
+
websocket_1.default.getWebsocket.send(JSON.stringify({
|
|
223
|
+
"type": "fsEvent",
|
|
224
|
+
"action": "searchFiles",
|
|
225
|
+
"message": {
|
|
226
|
+
path,
|
|
227
|
+
regex,
|
|
228
|
+
filePattern
|
|
229
|
+
}
|
|
230
|
+
}));
|
|
231
|
+
websocket_1.default.getWebsocket.on('message', (data) => {
|
|
232
|
+
const response = JSON.parse(data);
|
|
233
|
+
if (response.type === "searchFilesResponse") {
|
|
234
|
+
resolve(response);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
},
|
|
189
239
|
};
|
|
190
240
|
exports.default = cbfs;
|
package/package.json
CHANGED
package/src/modules/chat.ts
CHANGED
|
@@ -148,17 +148,18 @@ const cbchat = {
|
|
|
148
148
|
* Sends a confirmation request to the server with two options: Yes or No.
|
|
149
149
|
* @returns {Promise<string>} A promise that resolves with the server's response.
|
|
150
150
|
*/
|
|
151
|
-
sendConfirmationRequest: (confirmationMessage: string, buttons: string[] = []): Promise<string> => {
|
|
151
|
+
sendConfirmationRequest: (confirmationMessage: string, buttons: string[] = [],withFeedback:boolean=false): Promise<string> => {
|
|
152
152
|
return new Promise((resolve, reject) => {
|
|
153
153
|
cbws.getWebsocket.send(JSON.stringify({
|
|
154
154
|
"type": "confirmationRequest",
|
|
155
155
|
"message": confirmationMessage,
|
|
156
|
-
buttons: buttons
|
|
156
|
+
buttons: buttons,
|
|
157
|
+
withFeedback
|
|
157
158
|
|
|
158
159
|
}));
|
|
159
160
|
cbws.getWebsocket.on('message', (data: string) => {
|
|
160
161
|
const response = JSON.parse(data);
|
|
161
|
-
if (response.type === "confirmationResponse") {
|
|
162
|
+
if (response.type === "confirmationResponse" || response.type === "feedbackResponse" ) {
|
|
162
163
|
resolve(response); // Resolve the Promise with the server's response
|
|
163
164
|
}
|
|
164
165
|
});
|
package/src/modules/fs.ts
CHANGED
|
@@ -182,6 +182,57 @@ const cbfs = {
|
|
|
182
182
|
});
|
|
183
183
|
});
|
|
184
184
|
},
|
|
185
|
+
/**
|
|
186
|
+
* @function listCodeDefinitionNames
|
|
187
|
+
* @description Lists all code definition names in a given path.
|
|
188
|
+
* @param {string} path - The path to search for code definitions.
|
|
189
|
+
* @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the list of code definition names.
|
|
190
|
+
*/
|
|
191
|
+
listCodeDefinitionNames: (path: string): Promise<{success: boolean, result: any}> => {
|
|
192
|
+
return new Promise((resolve, reject) => {
|
|
193
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
194
|
+
"type": "fsEvent",
|
|
195
|
+
"action": "listCodeDefinitionNames",
|
|
196
|
+
"message": {
|
|
197
|
+
path
|
|
198
|
+
}
|
|
199
|
+
}));
|
|
200
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
201
|
+
const response = JSON.parse(data);
|
|
202
|
+
if (response.type === "listCodeDefinitionNamesResponse") {
|
|
203
|
+
resolve(response);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @function searchFiles
|
|
211
|
+
* @description Searches files in a given path using a regex pattern.
|
|
212
|
+
* @param {string} path - The path to search within.
|
|
213
|
+
* @param {string} regex - The regex pattern to search for.
|
|
214
|
+
* @param {string} filePattern - The file pattern to match files.
|
|
215
|
+
* @returns {Promise<{success: boolean, result: any}>} A promise that resolves with the search results.
|
|
216
|
+
*/
|
|
217
|
+
searchFiles: (path: string, regex: string, filePattern: string): Promise<{success: boolean, result: any}> => {
|
|
218
|
+
return new Promise((resolve, reject) => {
|
|
219
|
+
cbws.getWebsocket.send(JSON.stringify({
|
|
220
|
+
"type": "fsEvent",
|
|
221
|
+
"action": "searchFiles",
|
|
222
|
+
"message": {
|
|
223
|
+
path,
|
|
224
|
+
regex,
|
|
225
|
+
filePattern
|
|
226
|
+
}
|
|
227
|
+
}));
|
|
228
|
+
cbws.getWebsocket.on('message', (data: string) => {
|
|
229
|
+
const response = JSON.parse(data);
|
|
230
|
+
if (response.type === "searchFilesResponse") {
|
|
231
|
+
resolve(response);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
},
|
|
185
236
|
|
|
186
237
|
};
|
|
187
238
|
|