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.
@@ -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,CA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OAQM;IACO,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAsB7B,oBAAoB;CAiBlC"}
package/dist/esm/index.js CHANGED
@@ -2,177 +2,197 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import searchRoot from "./searchRoot.js";
4
4
  import { v4 as uuidv4 } from "uuid";
5
- // search root folder of project
6
- const rootdir = searchRoot();
7
- const timerfiledir = path.join(rootdir, ".timers");
8
5
  /**
9
- * createFile
10
- * @description create `.timers` file
11
- * @returns void
12
- * @throws If file operation fails
13
- * @example
14
- * await createFile();
6
+ * TimersManager
7
+ * @description
8
+ * Manages timers stored in a file.
9
+ * Each timer is stored as: `id start stop`.
10
+ *
11
+ * - Timers are persisted in a file
12
+ * - Expired timers are detected by polling
15
13
  */
16
- async function createFile() {
17
- if (!fs.existsSync(timerfiledir)) {
18
- fs.writeFile(timerfiledir, "", (data) => {
19
- console.log("The file was created in ", timerfiledir);
20
- });
14
+ export class TimersManager {
15
+ timerfiledir;
16
+ /**
17
+ * constructor
18
+ * @param timerfiledir(string, optional)
19
+ * If omitted, `.timers` under the project root is used.
20
+ */
21
+ constructor(timerfiledir) {
22
+ this.timerfiledir =
23
+ timerfiledir ?? path.join(searchRoot(), ".timers");
21
24
  }
22
- return;
23
- }
24
- /**
25
- * createTimer
26
- * @description Creates a new timer.
27
- * @param length Timer duration in milliseconds
28
- * @returns Promise that resolves to the timer ID (UUID)
29
- * @throws If length is invalid(e.g. length < 0) or file operation fails
30
- * @example
31
- * const newTimer = await createTimer(5000);
32
- * // newTimer will be id of the timer
33
- */
34
- export async function createTimer(length) {
35
- try {
36
- await createFile();
37
- if (length < 0) {
38
- throw new Error(`Invailed length: ${length}`);
25
+ /**
26
+ * createFile
27
+ * @description create `.timers` file
28
+ * @returns void
29
+ * @throws If file operation fails
30
+ */
31
+ async createFile() {
32
+ try {
33
+ await fs.promises.access(this.timerfiledir);
34
+ }
35
+ catch {
36
+ await fs.promises.writeFile(this.timerfiledir, "");
39
37
  }
40
- length = Math.trunc(length);
41
- // uuid, start, end
42
- const id = uuidv4();
43
- const now = Date.now();
44
- const newTimerData = `${id} ${now.toString()} ${(now + length).toString()}`;
45
- await fs.promises.appendFile(timerfiledir, newTimerData + "\n");
46
- return id;
47
- }
48
- catch (e) {
49
- throw new Error(`Error when creating timer: ${e}`);
50
38
  }
51
- }
52
- /**
53
- * removeTimer
54
- * @description Removes a timer by ID.
55
- * @param id ID of the timer to remove
56
- * @returns void
57
- * @throws If file operation fails
58
- * @example
59
- * await removeTimer(id);
60
- */
61
- export async function removeTimer(id) {
62
- try {
63
- const timersRaw = fs.readFileSync(timerfiledir, "utf-8");
64
- const timersData = timersRaw.split(/\r?\n/);
65
- let newTimersData = "";
66
- let found = false;
67
- for (const timerData of timersData) {
68
- if (!timerData.trim()) {
69
- found = true;
70
- continue;
39
+ /**
40
+ * createTimer
41
+ * @description Creates a new timer.
42
+ * @param length Timer duration in milliseconds
43
+ * @returns Promise that resolves to the timer ID (UUID)
44
+ * @throws If length is invalid(e.g. length < 0) or file operation fails
45
+ * @example
46
+ * const manager = new TimersManager();
47
+ * const newTimer = await manager.createTimer(5000);
48
+ * // newTimer will be id of the timer
49
+ */
50
+ async createTimer(length) {
51
+ try {
52
+ await this.createFile();
53
+ if (length < 0) {
54
+ throw new Error(`Invailed length: ${length}`);
71
55
  }
72
- const [timerId] = timerData.split(" ");
73
- if (timerId !== id) {
56
+ length = Math.trunc(length);
57
+ // uuid, start, end
58
+ const id = uuidv4();
59
+ const now = Date.now();
60
+ const newTimerData = `${id} ${now.toString()} ${(now + length).toString()}`;
61
+ await fs.promises.appendFile(this.timerfiledir, newTimerData + "\n");
62
+ return id;
63
+ }
64
+ catch (e) {
65
+ throw new Error(`Error when creating timer: ${e}`);
66
+ }
67
+ }
68
+ /**
69
+ * removeTimer
70
+ * @description Removes a timer by ID.
71
+ * @param id ID of the timer to remove
72
+ * @returns void
73
+ * @throws If file operation fails
74
+ * @example
75
+ * await manager.removeTimer(id);
76
+ */
77
+ async removeTimer(id) {
78
+ try {
79
+ const timersRaw = fs.readFileSync(this.timerfiledir, "utf-8");
80
+ const timersData = timersRaw.split(/\r?\n/);
81
+ let newTimersData = "";
82
+ let found = false;
83
+ for (const timerData of timersData) {
84
+ if (!timerData.trim())
85
+ continue;
86
+ const [timerId] = timerData.split(" ");
87
+ if (timerId === id) {
88
+ found = true;
89
+ continue;
90
+ }
74
91
  newTimersData += timerData + "\n";
75
92
  }
93
+ if (!found) {
94
+ throw new Error(`Timer with id ${id} not found`);
95
+ }
96
+ await fs.promises.writeFile(this.timerfiledir, newTimersData, "utf-8");
97
+ return;
76
98
  }
77
- if (!found) {
78
- throw new Error(`Timer with id ${id} not found`);
99
+ catch (e) {
100
+ throw new Error(`Error when removing timer: ${e}`);
79
101
  }
80
- await fs.promises.writeFile(timerfiledir, newTimersData, "utf-8");
81
- return;
82
102
  }
83
- catch (e) {
84
- throw new Error(`Error when removing timer: ${e}`);
103
+ /**
104
+ * @description Starts monitoring expired timers asynchronously and returns immediately. The callback is invoked asynchronously when a timer expires.
105
+ * The callback is awaited before continuing.
106
+ * @param callback Function invoked when an expired timer is detected (called asynchronously)
107
+ * @param interval (number, optional): Check interval in milliseconds (default: 50ms)
108
+ * @throws If file operation fails
109
+ * @example
110
+ * manager.checkTimers((timer) => {
111
+ * console.log(`A timer was stopped: ${timer.id}`);
112
+ * });
113
+ */
114
+ async checkTimers(callback, interval = 50) {
115
+ try {
116
+ await this.createFile();
117
+ setInterval(async () => {
118
+ const timersDataRaw = await fs.promises.readFile(this.timerfiledir, "utf-8");
119
+ const timersData = timersDataRaw.split(/\r?\n/);
120
+ const timersSet = new Set();
121
+ await this.checkTimerfileSyntax(timersDataRaw);
122
+ for (const timerData of timersData) {
123
+ if (!timerData.trim())
124
+ continue;
125
+ const [id, startStr, stopStr] = timerData.split(" ");
126
+ timersSet.add({
127
+ id: id,
128
+ start: Number(startStr),
129
+ stop: Number(stopStr),
130
+ });
131
+ }
132
+ const now = Date.now();
133
+ for (const timer of timersSet) {
134
+ if (Number(timer.stop) <= now) {
135
+ await this.removeTimer(timer.id);
136
+ await callback(timer);
137
+ }
138
+ }
139
+ }, interval);
140
+ }
141
+ catch (e) {
142
+ throw new Error(`Error when checking alarm: ${e}`);
143
+ }
85
144
  }
86
- }
87
- /**
88
- * @description Starts monitoring expired timers asynchronously and returns immediately. The callback is invoked asynchronously when a timer expires.
89
- * @param callback Function invoked when an expired timer is detected (called asynchronously)
90
- * @param interval (number, optional): Check interval in milliseconds (default: 50ms)
91
- * @throws If file operation fails
92
- * @example
93
- * checkTimers((timer) => {
94
- * console.log(`A timer was stopped: ${timer.id}`);
95
- * });
96
- */
97
- export async function checkTimers(callback, interval = 50) {
98
- try {
99
- await createFile();
100
- setInterval(() => {
101
- const timersDataRaw = fs.readFileSync(timerfiledir, "utf-8");
102
- const timersData = timersDataRaw.split(/\r?\n/);
103
- const timersSet = new Set();
104
- checkTimerfileSyntax(timersDataRaw);
145
+ /**
146
+ * showTimers
147
+ * @description Retrieves all active timers.
148
+ * @returns Array of `Timer` objects
149
+ * @throws If file operation fails
150
+ * @example
151
+ * const timers = await manager.showTimers();
152
+ * console.log(JSON.stringify(timers))
153
+ */
154
+ async showTimers() {
155
+ try {
156
+ await this.createFile();
157
+ const timersRaw = fs.readFileSync(this.timerfiledir, "utf-8");
158
+ const timersData = timersRaw.split(/\r?\n/);
159
+ const timersJSON = [];
105
160
  for (const timerData of timersData) {
161
+ const splitedTimerData = timerData.split(" ");
106
162
  if (!timerData.trim())
107
163
  continue;
108
- const [id, startStr, stopStr] = timerData.split(" ");
109
- timersSet.add({
110
- id: id,
111
- start: startStr,
112
- stop: stopStr
164
+ timersJSON.push({
165
+ id: splitedTimerData[0],
166
+ start: Number(splitedTimerData[1]),
167
+ stop: Number(splitedTimerData[2]),
113
168
  });
114
169
  }
115
- const now = Date.now();
116
- for (const timer of timersSet) {
117
- if (Number(timer.stop) <= now) {
118
- removeTimer(timer.id);
119
- callback(timer);
120
- }
121
- }
122
- }, interval);
123
- }
124
- catch (e) {
125
- throw new Error(`Error when checking alarm: ${e}`);
170
+ return timersJSON;
171
+ }
172
+ catch (e) {
173
+ throw new Error(`Error when showing timers: ${e}`);
174
+ }
126
175
  }
127
- }
128
- /**
129
- * showTimers
130
- * @description Retrieves all active timers.
131
- * @returns Array of `Timer` objects
132
- * @throws If file operation fails
133
- * @example
134
- * const timers = await showTimers();
135
- * console.log(JSON.stringify(timers))
136
- */
137
- export async function showTimers() {
138
- try {
139
- await createFile();
140
- const timersRaw = fs.readFileSync(timerfiledir, "utf-8");
141
- const timersData = timersRaw.split(/\r?\n/);
142
- let timersJSON = [];
176
+ async checkTimerfileSyntax(fileData) {
177
+ const throwing = () => {
178
+ throw new Error(`Timer file's syntax is wrong`);
179
+ };
180
+ const timersData = fileData
181
+ .split('\n')
182
+ .map(l => l.trim())
183
+ .filter(l => l !== "");
143
184
  for (const timerData of timersData) {
144
- const splitedTimerData = timerData.split(" ");
145
- timersJSON.push({
146
- id: splitedTimerData[0],
147
- start: splitedTimerData[1],
148
- stop: splitedTimerData[2]
149
- });
185
+ const timerArray = timerData.split(/\s+/);
186
+ if (timerArray.length !== 3)
187
+ throwing();
188
+ if (timerArray[0]?.length !== 36)
189
+ throwing();
190
+ if (timerArray[1].trim() === "")
191
+ throwing();
192
+ if (timerArray[2].trim() === "")
193
+ throwing();
150
194
  }
151
- return timersJSON;
152
- }
153
- catch (e) {
154
- throw new Error(`Error when showing timers: ${e}`);
155
- }
156
- }
157
- async function checkTimerfileSyntax(fileData) {
158
- const throwing = () => {
159
- throw new Error(`Timer file's syntax is wrong`);
160
- };
161
- const timersData = fileData
162
- .split('\n')
163
- .map(l => l.trim())
164
- .filter(l => l !== "");
165
- for (const timerData of timersData) {
166
- const timerArray = timerData.split(/\s+/);
167
- if (timerArray.length !== 3)
168
- throwing();
169
- if (timerArray[0]?.length !== 36)
170
- throwing();
171
- if (timerArray[1].trim() === "")
172
- throwing();
173
- if (timerArray[2].trim() === "")
174
- throwing();
195
+ return;
175
196
  }
176
- return;
177
197
  }
178
198
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAQpC,gCAAgC;AAChC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAEnD;;;;;;;GAOG;AACH,KAAK,UAAU,UAAU;IACrB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC/B,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE;YACpC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,YAAY,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO;AACX,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc;IAC5C,IAAI,CAAC;QACD,MAAM,UAAU,EAAE,CAAC;QAEnB,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE5B,mBAAmB;QACnB,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,YAAY,GAAG,GAAG,EAAE,IAAI,GAAG,CAAC,QAAQ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G,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,IAAI,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":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU;IACjC,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,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"}