@codebolt/codeboltjs 1.1.65 → 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 +8 -0
- package/modules/fs.d.ts +22 -0
- package/modules/fs.js +50 -0
- package/package.json +1 -1
- 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>;
|
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/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
|
|