wispjs 2.1.4 → 2.2.0

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.
@@ -79,10 +79,11 @@ export declare class WispSocket {
79
79
  * Searches all file contents for the given query
80
80
  *
81
81
  * @param query The query string to search for
82
+ * @param timeout How long to wait (in ms) for results before timing out
82
83
  *
83
84
  * @public
84
85
  */
85
- filesearch(query: string): Promise<FilesearchResults>;
86
+ filesearch(query: string, timeout?: number): Promise<FilesearchResults>;
86
87
  /**
87
88
  * Performs a git pull operation on the given directory
88
89
  *
@@ -89,10 +89,11 @@ export class WispSocket {
89
89
  * Searches all file contents for the given query
90
90
  *
91
91
  * @param query The query string to search for
92
+ * @param timeout How long to wait (in ms) for results before timing out
92
93
  *
93
94
  * @public
94
95
  */
95
- async filesearch(query) {
96
+ async filesearch(query, timeout = 10000) {
96
97
  this.logger.info("Running filesearch with: ", query);
97
98
  await this.verifyPool();
98
99
  return await this.pool.run((worker) => {
@@ -100,13 +101,13 @@ export class WispSocket {
100
101
  const logger = worker.logger;
101
102
  logger.log("Running filesearch:", query);
102
103
  return new Promise((resolve, reject) => {
103
- const timeout = setTimeout(() => {
104
+ const timeoutObj = setTimeout(() => {
104
105
  socket.off("filesearch-results");
105
106
  logger.error("Rejected filesearch: 'Timeout'");
106
107
  reject();
107
- }, 10000);
108
+ }, timeout);
108
109
  socket.once("filesearch-results", (data) => {
109
- clearTimeout(timeout);
110
+ clearTimeout(timeoutObj);
110
111
  resolve(data);
111
112
  });
112
113
  socket.emit("filesearch-start", query);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wispjs",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "description": "A package for interacting with Wisp-based server panels",
6
6
  "main": "dist/wisp.js",