eternal-timer 1.5.0 → 2.0.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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ A simple and persistent timer library for Node.js. Timers are saved to a file an
4
4
 
5
5
  ## Features
6
6
 
7
- - **Monitor Timers (asynchronous)**: Start monitoring expired timers asynchronously; the function returns immediately and the callback is invoked when timers expire.
7
+ - **Monitor Timers (asynchronous)**: Start monitoring expired timers asynchronously; the function returns immediately and the callback is called when timers expire.
8
8
  - **Persistence**: Save timer data to a file that persists across process restarts
9
9
 
10
10
  ## Installation
@@ -18,29 +18,40 @@ npm install eternal-timer
18
18
  ### Basic Example
19
19
 
20
20
  ```typescript
21
- import { createTimer, checkTimers, removeTimer, showTimers } from 'eternal-timer';
21
+ import { TimersManager } from 'eternal-timer';
22
22
 
23
23
  async function main() {
24
- // Create a timer (5 seconds)
25
- const timerId = await createTimer(5000);
26
- console.log('Timer created:', timerId);
24
+ const manager = new TimersManager();
27
25
 
28
- // Monitor timers (executes when timer expires)
29
- checkTimers((timer) => {
30
- console.log('Timer expired:', timer.id);
31
- });
26
+ // Create a timer (5 seconds)
27
+ const timerId = await manager.createTimer(5000);
28
+ console.log('Timer created:', timerId);
32
29
 
33
- // Display all timers
34
- const timers = await showTimers();
35
- console.log('Active timers:', timers);
30
+ // Monitor timers (executes when timer expires)
31
+ manager.checkTimers(async (timer) => {
32
+ console.log('Timer expired:', timer.id);
33
+ });
36
34
 
37
- // Remove a timer
38
- await removeTimer(timerId);
35
+ // Display all timers
36
+ const timers = await manager.showTimers();
37
+ console.log('Active timers:', timers);
38
+
39
+ // Remove a timer
40
+ await manager.removeTimer(timerId);
39
41
  }
42
+
43
+ main();
40
44
  ```
41
45
 
42
46
  ## API
43
47
 
48
+ ### `new TimersManager(timerfiledir?: string)`
49
+
50
+ Creates a new `TimersManager` instance.
51
+
52
+ **Parameters:**
53
+ - `timerfiledir` (string, optional): The path to the directory where the timer file is stored. If omitted, `.timers` under the project root is used.
54
+
44
55
  ### `createTimer(length: number): Promise<string>`
45
56
 
46
57
  Creates a new timer.
@@ -52,7 +63,7 @@ Creates a new timer.
52
63
 
53
64
  **Throws:** If length is invalid(e.g. length < 0) or file operation fails
54
65
 
55
- ### `removeTimer(id: string): Promise<boolean>`
66
+ ### `removeTimer(id: string): Promise<void>`
56
67
 
57
68
  Removes a timer by ID.
58
69
 
@@ -61,12 +72,17 @@ Removes a timer by ID.
61
72
 
62
73
  **Returns:** void
63
74
 
64
- ### `checkTimers(callback: (timer: Timer) => void, interval?: number): Promise<void>`
75
+ **Throws:** If the timer with the specified ID is not found or if a file operation fails.
76
+
77
+ ### `checkTimers(callback: (timer: Timer) => Promise<void>, interval?: number): Promise<void>`
78
+
79
+ Starts monitoring expired timers and returns immediately.
65
80
 
66
- Starts monitoring expired timers asynchronously and returns immediately. The callback is invoked asynchronously when a timer expires.
81
+ The callback is invoked when a timer expires during periodic checks.
82
+ The callback is awaited before the next timer check continues.
67
83
 
68
84
  **Parameters:**
69
- - `callback`: Function invoked when an expired timer is detected (called asynchronously)
85
+ - `callback`: Function invoked when an expired timer is detected (called during periodic checks and awaited)
70
86
  - `interval` (number, optional): Check interval in milliseconds (default: 50ms)
71
87
 
72
88
  **Throws:** If file operation fails
@@ -84,8 +100,8 @@ Retrieves all active timers.
84
100
  ```typescript
85
101
  type Timer = {
86
102
  id: string; // Unique timer identifier (UUID)
87
- start: string; // Timer start timestamp
88
- stop: string; // Timer end timestamp
103
+ start: number; // Timer start timestamp
104
+ stop: number; // Timer end timestamp
89
105
  }
90
106
  ```
91
107
 
@@ -111,4 +127,4 @@ Licensed under the Apache License, Version 2.0. See the `LICENSE` file for detai
111
127
 
112
128
  ## Repository
113
129
 
114
- https://github.com/SUKEsann2000/eternal-timer
130
+ https://github.com/SUKEsann2000/eternal-timer
@@ -3,185 +3,203 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createTimer = createTimer;
7
- exports.removeTimer = removeTimer;
8
- exports.checkTimers = checkTimers;
9
- exports.showTimers = showTimers;
6
+ exports.TimersManager = void 0;
10
7
  const fs_1 = __importDefault(require("fs"));
11
8
  const path_1 = __importDefault(require("path"));
12
9
  const searchRoot_js_1 = __importDefault(require("./searchRoot.js"));
13
10
  const uuid_1 = require("uuid");
14
- // search root folder of project
15
- const rootdir = (0, searchRoot_js_1.default)();
16
- const timerfiledir = path_1.default.join(rootdir, ".timers");
17
11
  /**
18
- * createFile
19
- * @description create `.timers` file
20
- * @returns void
21
- * @throws If file operation fails
22
- * @example
23
- * await createFile();
12
+ * TimersManager
13
+ * @description
14
+ * Manages timers stored in a file.
15
+ * Each timer is stored as: `id start stop`.
16
+ *
17
+ * - Timers are persisted in a file
18
+ * - Expired timers are detected by polling
24
19
  */
25
- async function createFile() {
26
- if (!fs_1.default.existsSync(timerfiledir)) {
27
- fs_1.default.writeFile(timerfiledir, "", (data) => {
28
- console.log("The file was created in ", timerfiledir);
29
- });
20
+ class TimersManager {
21
+ timerfiledir;
22
+ /**
23
+ * constructor
24
+ * @param timerfiledir(string, optional)
25
+ * If omitted, `.timers` under the project root is used.
26
+ */
27
+ constructor(timerfiledir) {
28
+ this.timerfiledir =
29
+ timerfiledir ?? path_1.default.join((0, searchRoot_js_1.default)(), ".timers");
30
30
  }
31
- return;
32
- }
33
- /**
34
- * createTimer
35
- * @description Creates a new timer.
36
- * @param length Timer duration in milliseconds
37
- * @returns Promise that resolves to the timer ID (UUID)
38
- * @throws If length is invalid(e.g. length < 0) or file operation fails
39
- * @example
40
- * const newTimer = await createTimer(5000);
41
- * // newTimer will be id of the timer
42
- */
43
- async function createTimer(length) {
44
- try {
45
- await createFile();
46
- if (length < 0) {
47
- throw new Error(`Invailed length: ${length}`);
31
+ /**
32
+ * createFile
33
+ * @description create `.timers` file
34
+ * @returns void
35
+ * @throws If file operation fails
36
+ */
37
+ async createFile() {
38
+ try {
39
+ await fs_1.default.promises.access(this.timerfiledir);
40
+ }
41
+ catch {
42
+ await fs_1.default.promises.writeFile(this.timerfiledir, "");
48
43
  }
49
- length = Math.trunc(length);
50
- // uuid, start, end
51
- const id = (0, uuid_1.v4)();
52
- const now = Date.now();
53
- const newTimerData = `${id} ${now.toString()} ${(now + length).toString()}`;
54
- await fs_1.default.promises.appendFile(timerfiledir, newTimerData + "\n");
55
- return id;
56
- }
57
- catch (e) {
58
- throw new Error(`Error when creating timer: ${e}`);
59
44
  }
60
- }
61
- /**
62
- * removeTimer
63
- * @description Removes a timer by ID.
64
- * @param id ID of the timer to remove
65
- * @returns void
66
- * @throws If file operation fails
67
- * @example
68
- * await removeTimer(id);
69
- */
70
- async function removeTimer(id) {
71
- try {
72
- const timersRaw = fs_1.default.readFileSync(timerfiledir, "utf-8");
73
- const timersData = timersRaw.split(/\r?\n/);
74
- let newTimersData = "";
75
- let found = false;
76
- for (const timerData of timersData) {
77
- if (!timerData.trim()) {
78
- found = true;
79
- continue;
45
+ /**
46
+ * createTimer
47
+ * @description Creates a new timer.
48
+ * @param length Timer duration in milliseconds
49
+ * @returns Promise that resolves to the timer ID (UUID)
50
+ * @throws If length is invalid(e.g. length < 0) or file operation fails
51
+ * @example
52
+ * const manager = new TimersManager();
53
+ * const newTimer = await manager.createTimer(5000);
54
+ * // newTimer will be id of the timer
55
+ */
56
+ async createTimer(length) {
57
+ try {
58
+ await this.createFile();
59
+ if (length < 0) {
60
+ throw new Error(`Invailed length: ${length}`);
80
61
  }
81
- const [timerId] = timerData.split(" ");
82
- if (timerId !== id) {
62
+ length = Math.trunc(length);
63
+ // uuid, start, end
64
+ const id = (0, uuid_1.v4)();
65
+ const now = Date.now();
66
+ const newTimerData = `${id} ${now.toString()} ${(now + length).toString()}`;
67
+ await fs_1.default.promises.appendFile(this.timerfiledir, newTimerData + "\n");
68
+ return id;
69
+ }
70
+ catch (e) {
71
+ throw new Error(`Error when creating timer: ${e}`);
72
+ }
73
+ }
74
+ /**
75
+ * removeTimer
76
+ * @description Removes a timer by ID.
77
+ * @param id ID of the timer to remove
78
+ * @returns void
79
+ * @throws If file operation fails
80
+ * @example
81
+ * await manager.removeTimer(id);
82
+ */
83
+ async removeTimer(id) {
84
+ try {
85
+ const timersRaw = fs_1.default.readFileSync(this.timerfiledir, "utf-8");
86
+ const timersData = timersRaw.split(/\r?\n/);
87
+ let newTimersData = "";
88
+ let found = false;
89
+ for (const timerData of timersData) {
90
+ if (!timerData.trim())
91
+ continue;
92
+ const [timerId] = timerData.split(" ");
93
+ if (timerId === id) {
94
+ found = true;
95
+ continue;
96
+ }
83
97
  newTimersData += timerData + "\n";
84
98
  }
99
+ if (!found) {
100
+ throw new Error(`Timer with id ${id} not found`);
101
+ }
102
+ await fs_1.default.promises.writeFile(this.timerfiledir, newTimersData, "utf-8");
103
+ return;
85
104
  }
86
- if (!found) {
87
- throw new Error(`Timer with id ${id} not found`);
105
+ catch (e) {
106
+ throw new Error(`Error when removing timer: ${e}`);
88
107
  }
89
- await fs_1.default.promises.writeFile(timerfiledir, newTimersData, "utf-8");
90
- return;
91
108
  }
92
- catch (e) {
93
- throw new Error(`Error when removing timer: ${e}`);
109
+ /**
110
+ * @description Starts monitoring expired timers asynchronously and returns immediately. The callback is invoked asynchronously when a timer expires.
111
+ * The callback is awaited before continuing.
112
+ * @param callback Function invoked when an expired timer is detected (called asynchronously)
113
+ * @param interval (number, optional): Check interval in milliseconds (default: 50ms)
114
+ * @throws If file operation fails
115
+ * @example
116
+ * manager.checkTimers((timer) => {
117
+ * console.log(`A timer was stopped: ${timer.id}`);
118
+ * });
119
+ */
120
+ async checkTimers(callback, interval = 50) {
121
+ try {
122
+ await this.createFile();
123
+ setInterval(async () => {
124
+ const timersDataRaw = await fs_1.default.promises.readFile(this.timerfiledir, "utf-8");
125
+ const timersData = timersDataRaw.split(/\r?\n/);
126
+ const timersSet = new Set();
127
+ await this.checkTimerfileSyntax(timersDataRaw);
128
+ for (const timerData of timersData) {
129
+ if (!timerData.trim())
130
+ continue;
131
+ const [id, startStr, stopStr] = timerData.split(" ");
132
+ timersSet.add({
133
+ id: id,
134
+ start: Number(startStr),
135
+ stop: Number(stopStr),
136
+ });
137
+ }
138
+ const now = Date.now();
139
+ for (const timer of timersSet) {
140
+ if (Number(timer.stop) <= now) {
141
+ await this.removeTimer(timer.id);
142
+ await callback(timer);
143
+ }
144
+ }
145
+ }, interval);
146
+ }
147
+ catch (e) {
148
+ throw new Error(`Error when checking alarm: ${e}`);
149
+ }
94
150
  }
95
- }
96
- /**
97
- * @description Starts monitoring expired timers asynchronously and returns immediately. The callback is invoked asynchronously when a timer expires.
98
- * @param callback Function invoked when an expired timer is detected (called asynchronously)
99
- * @param interval (number, optional): Check interval in milliseconds (default: 50ms)
100
- * @throws If file operation fails
101
- * @example
102
- * checkTimers((timer) => {
103
- * console.log(`A timer was stopped: ${timer.id}`);
104
- * });
105
- */
106
- async function checkTimers(callback, interval = 50) {
107
- try {
108
- await createFile();
109
- setInterval(() => {
110
- const timersDataRaw = fs_1.default.readFileSync(timerfiledir, "utf-8");
111
- const timersData = timersDataRaw.split(/\r?\n/);
112
- const timersSet = new Set();
113
- checkTimerfileSyntax(timersDataRaw);
151
+ /**
152
+ * showTimers
153
+ * @description Retrieves all active timers.
154
+ * @returns Array of `Timer` objects
155
+ * @throws If file operation fails
156
+ * @example
157
+ * const timers = await manager.showTimers();
158
+ * console.log(JSON.stringify(timers))
159
+ */
160
+ async showTimers() {
161
+ try {
162
+ await this.createFile();
163
+ const timersRaw = fs_1.default.readFileSync(this.timerfiledir, "utf-8");
164
+ const timersData = timersRaw.split(/\r?\n/);
165
+ const timersJSON = [];
114
166
  for (const timerData of timersData) {
167
+ const splitedTimerData = timerData.split(" ");
115
168
  if (!timerData.trim())
116
169
  continue;
117
- const [id, startStr, stopStr] = timerData.split(" ");
118
- timersSet.add({
119
- id: id,
120
- start: startStr,
121
- stop: stopStr
170
+ timersJSON.push({
171
+ id: splitedTimerData[0],
172
+ start: Number(splitedTimerData[1]),
173
+ stop: Number(splitedTimerData[2]),
122
174
  });
123
175
  }
124
- const now = Date.now();
125
- for (const timer of timersSet) {
126
- if (Number(timer.stop) <= now) {
127
- removeTimer(timer.id);
128
- callback(timer);
129
- }
130
- }
131
- }, interval);
132
- }
133
- catch (e) {
134
- throw new Error(`Error when checking alarm: ${e}`);
176
+ return timersJSON;
177
+ }
178
+ catch (e) {
179
+ throw new Error(`Error when showing timers: ${e}`);
180
+ }
135
181
  }
136
- }
137
- /**
138
- * showTimers
139
- * @description Retrieves all active timers.
140
- * @returns Array of `Timer` objects
141
- * @throws If file operation fails
142
- * @example
143
- * const timers = await showTimers();
144
- * console.log(JSON.stringify(timers))
145
- */
146
- async function showTimers() {
147
- try {
148
- await createFile();
149
- const timersRaw = fs_1.default.readFileSync(timerfiledir, "utf-8");
150
- const timersData = timersRaw.split(/\r?\n/);
151
- let timersJSON = [];
182
+ async checkTimerfileSyntax(fileData) {
183
+ const throwing = () => {
184
+ throw new Error(`Timer file's syntax is wrong`);
185
+ };
186
+ const timersData = fileData
187
+ .split('\n')
188
+ .map(l => l.trim())
189
+ .filter(l => l !== "");
152
190
  for (const timerData of timersData) {
153
- const splitedTimerData = timerData.split(" ");
154
- timersJSON.push({
155
- id: splitedTimerData[0],
156
- start: splitedTimerData[1],
157
- stop: splitedTimerData[2]
158
- });
191
+ const timerArray = timerData.split(/\s+/);
192
+ if (timerArray.length !== 3)
193
+ throwing();
194
+ if (timerArray[0]?.length !== 36)
195
+ throwing();
196
+ if (timerArray[1].trim() === "")
197
+ throwing();
198
+ if (timerArray[2].trim() === "")
199
+ throwing();
159
200
  }
160
- return timersJSON;
161
- }
162
- catch (e) {
163
- throw new Error(`Error when showing timers: ${e}`);
164
- }
165
- }
166
- async function checkTimerfileSyntax(fileData) {
167
- const throwing = () => {
168
- throw new Error(`Timer file's syntax is wrong`);
169
- };
170
- const timersData = fileData
171
- .split('\n')
172
- .map(l => l.trim())
173
- .filter(l => l !== "");
174
- for (const timerData of timersData) {
175
- const timerArray = timerData.split(/\s+/);
176
- if (timerArray.length !== 3)
177
- throwing();
178
- if (timerArray[0]?.length !== 36)
179
- throwing();
180
- if (timerArray[1].trim() === "")
181
- throwing();
182
- if (timerArray[2].trim() === "")
183
- throwing();
201
+ return;
184
202
  }
185
- return;
186
203
  }
204
+ exports.TimersManager = TimersManager;
187
205
  //# sourceMappingURL=index.js.map
@@ -1,48 +1,76 @@
1
1
  export type Timer = {
2
2
  id: string;
3
- start: string;
4
- stop: string;
3
+ start: number;
4
+ stop: number;
5
5
  };
6
6
  /**
7
- * createTimer
8
- * @description Creates a new timer.
9
- * @param length Timer duration in milliseconds
10
- * @returns Promise that resolves to the timer ID (UUID)
11
- * @throws If length is invalid(e.g. length < 0) or file operation fails
12
- * @example
13
- * const newTimer = await createTimer(5000);
14
- * // newTimer will be id of the timer
7
+ * TimersManager
8
+ * @description
9
+ * Manages timers stored in a file.
10
+ * Each timer is stored as: `id start stop`.
11
+ *
12
+ * - Timers are persisted in a file
13
+ * - Expired timers are detected by polling
15
14
  */
16
- export declare function createTimer(length: number): Promise<string>;
17
- /**
18
- * removeTimer
19
- * @description Removes a timer by ID.
20
- * @param id ID of the timer to remove
21
- * @returns void
22
- * @throws If file operation fails
23
- * @example
24
- * await removeTimer(id);
25
- */
26
- export declare function removeTimer(id: string): Promise<void>;
27
- /**
28
- * @description Starts monitoring expired timers asynchronously and returns immediately. The callback is invoked asynchronously when a timer expires.
29
- * @param callback Function invoked when an expired timer is detected (called asynchronously)
30
- * @param interval (number, optional): Check interval in milliseconds (default: 50ms)
31
- * @throws If file operation fails
32
- * @example
33
- * checkTimers((timer) => {
34
- * console.log(`A timer was stopped: ${timer.id}`);
35
- * });
36
- */
37
- export declare function checkTimers(callback: (timer: Timer) => void, interval?: number): Promise<void>;
38
- /**
39
- * showTimers
40
- * @description Retrieves all active timers.
41
- * @returns Array of `Timer` objects
42
- * @throws If file operation fails
43
- * @example
44
- * const timers = await showTimers();
45
- * console.log(JSON.stringify(timers))
46
- */
47
- export declare function showTimers(): Promise<Timer[]>;
15
+ export declare class TimersManager {
16
+ private readonly timerfiledir;
17
+ /**
18
+ * constructor
19
+ * @param timerfiledir(string, optional)
20
+ * If omitted, `.timers` under the project root is used.
21
+ */
22
+ constructor(timerfiledir?: string);
23
+ /**
24
+ * createFile
25
+ * @description create `.timers` file
26
+ * @returns void
27
+ * @throws If file operation fails
28
+ */
29
+ private createFile;
30
+ /**
31
+ * createTimer
32
+ * @description Creates a new timer.
33
+ * @param length Timer duration in milliseconds
34
+ * @returns Promise that resolves to the timer ID (UUID)
35
+ * @throws If length is invalid(e.g. length < 0) or file operation fails
36
+ * @example
37
+ * const manager = new TimersManager();
38
+ * const newTimer = await manager.createTimer(5000);
39
+ * // newTimer will be id of the timer
40
+ */
41
+ createTimer(length: number): Promise<string>;
42
+ /**
43
+ * removeTimer
44
+ * @description Removes a timer by ID.
45
+ * @param id ID of the timer to remove
46
+ * @returns void
47
+ * @throws If file operation fails
48
+ * @example
49
+ * await manager.removeTimer(id);
50
+ */
51
+ removeTimer(id: string): Promise<void>;
52
+ /**
53
+ * @description Starts monitoring expired timers asynchronously and returns immediately. The callback is invoked asynchronously when a timer expires.
54
+ * The callback is awaited before continuing.
55
+ * @param callback Function invoked when an expired timer is detected (called asynchronously)
56
+ * @param interval (number, optional): Check interval in milliseconds (default: 50ms)
57
+ * @throws If file operation fails
58
+ * @example
59
+ * manager.checkTimers((timer) => {
60
+ * console.log(`A timer was stopped: ${timer.id}`);
61
+ * });
62
+ */
63
+ checkTimers(callback: (timer: Timer) => Promise<void>, interval?: number): Promise<void>;
64
+ /**
65
+ * showTimers
66
+ * @description Retrieves all active timers.
67
+ * @returns Array of `Timer` objects
68
+ * @throws If file operation fails
69
+ * @example
70
+ * const timers = await manager.showTimers();
71
+ * console.log(JSON.stringify(timers))
72
+ */
73
+ showTimers(): Promise<Timer[]>;
74
+ private checkTimerfileSyntax;
75
+ }
48
76
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,KAAK,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAuBD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBjE;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB3D;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAAE,QAAQ,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCxG;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,CAmBnD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,KAAK,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IAEtC;;;;OAIM;gBAEL,YAAY,CAAC,EAAE,MAAM;IAMtB;;;;;OAKM;YACQ,UAAU;IAQxB;;;;;;;;;;OAUM;IACO,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqBzD;;;;;;;;OAQM;IACO,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC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AC,GAAG,EAAE,CAAC;IACxB,OAAO,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QACtB,GAAG,GAAG,MAAM,CAAC;IACrB,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"searchRoot.js","sourceRoot":"","sources":["../../src/searchRoot.ts"],"names":[],"mappings":";;;;;AAQA,6BAQC;AAhBD,4CAAoB;AACpB,gDAAwB;AAExB;;;;GAIG;AACH,SAAwB,UAAU;IACjC,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,OAAO,CAAC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACvD,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}