eternal-timer 2.5.0 → 3.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.
Files changed (67) hide show
  1. package/README.md +52 -23
  2. package/dist/cjs/TimersManager/JSONLTimersManager.d.ts +17 -5
  3. package/dist/cjs/TimersManager/JSONLTimersManager.d.ts.map +1 -1
  4. package/dist/cjs/TimersManager/{JSONLTimersManager.cjs → JSONLTimersManager.js} +18 -22
  5. package/dist/cjs/TimersManager/JSONLTimersManager.js.map +1 -0
  6. package/dist/cjs/TimersManager/PlainTextTimersManager.d.ts +2 -1
  7. package/dist/cjs/TimersManager/PlainTextTimersManager.d.ts.map +1 -1
  8. package/dist/cjs/TimersManager/{PlainTextTimersManager.cjs → PlainTextTimersManager.js} +3 -2
  9. package/dist/cjs/TimersManager/{PlainTextTimersManager.cjs.map → PlainTextTimersManager.js.map} +1 -1
  10. package/dist/cjs/TimersManager/TimersManager.d.ts +16 -15
  11. package/dist/cjs/TimersManager/TimersManager.d.ts.map +1 -1
  12. package/dist/cjs/TimersManager/{TimersManager.cjs → TimersManager.js} +17 -13
  13. package/dist/cjs/TimersManager/TimersManager.js.map +1 -0
  14. package/dist/cjs/TimersStore/JSONLTimersStore.d.ts +4 -4
  15. package/dist/cjs/TimersStore/JSONLTimersStore.d.ts.map +1 -1
  16. package/dist/cjs/TimersStore/{JSONLTimersStore.cjs → JSONLTimersStore.js} +6 -4
  17. package/dist/cjs/TimersStore/JSONLTimersStore.js.map +1 -0
  18. package/dist/cjs/TimersStore/PlainTextTimersStore.d.ts +4 -4
  19. package/dist/cjs/TimersStore/PlainTextTimersStore.d.ts.map +1 -1
  20. package/dist/cjs/TimersStore/{PlainTextTimersStore.cjs → PlainTextTimersStore.js} +1 -1
  21. package/dist/cjs/TimersStore/{PlainTextTimersStore.cjs.map → PlainTextTimersStore.js.map} +1 -1
  22. package/dist/cjs/TimersStore/TimersStore.d.ts +7 -7
  23. package/dist/cjs/TimersStore/TimersStore.d.ts.map +1 -1
  24. package/dist/cjs/TimersStore/{TimersStore.cjs → TimersStore.js} +4 -4
  25. package/dist/cjs/TimersStore/TimersStore.js.map +1 -0
  26. package/dist/cjs/{index.cjs → index.js} +2 -2
  27. package/dist/cjs/package.json +3 -0
  28. package/dist/cjs/types.d.ts +5 -7
  29. package/dist/cjs/types.d.ts.map +1 -1
  30. package/dist/esm/TimersManager/JSONLTimersManager.d.ts +17 -5
  31. package/dist/esm/TimersManager/JSONLTimersManager.d.ts.map +1 -1
  32. package/dist/esm/TimersManager/JSONLTimersManager.js +16 -20
  33. package/dist/esm/TimersManager/JSONLTimersManager.js.map +1 -1
  34. package/dist/esm/TimersManager/PlainTextTimersManager.d.ts +2 -1
  35. package/dist/esm/TimersManager/PlainTextTimersManager.d.ts.map +1 -1
  36. package/dist/esm/TimersManager/PlainTextTimersManager.js +1 -0
  37. package/dist/esm/TimersManager/PlainTextTimersManager.js.map +1 -1
  38. package/dist/esm/TimersManager/TimersManager.d.ts +16 -15
  39. package/dist/esm/TimersManager/TimersManager.d.ts.map +1 -1
  40. package/dist/esm/TimersManager/TimersManager.js +15 -11
  41. package/dist/esm/TimersManager/TimersManager.js.map +1 -1
  42. package/dist/esm/TimersStore/JSONLTimersStore.d.ts +4 -4
  43. package/dist/esm/TimersStore/JSONLTimersStore.d.ts.map +1 -1
  44. package/dist/esm/TimersStore/JSONLTimersStore.js +5 -3
  45. package/dist/esm/TimersStore/JSONLTimersStore.js.map +1 -1
  46. package/dist/esm/TimersStore/PlainTextTimersStore.d.ts +4 -4
  47. package/dist/esm/TimersStore/PlainTextTimersStore.d.ts.map +1 -1
  48. package/dist/esm/TimersStore/PlainTextTimersStore.js.map +1 -1
  49. package/dist/esm/TimersStore/TimersStore.d.ts +7 -7
  50. package/dist/esm/TimersStore/TimersStore.d.ts.map +1 -1
  51. package/dist/esm/TimersStore/TimersStore.js +4 -4
  52. package/dist/esm/TimersStore/TimersStore.js.map +1 -1
  53. package/dist/esm/package.json +3 -0
  54. package/dist/esm/types.d.ts +5 -7
  55. package/dist/esm/types.d.ts.map +1 -1
  56. package/package.json +10 -17
  57. package/dist/cjs/TimersManager/JSONLTimersManager.cjs.map +0 -1
  58. package/dist/cjs/TimersManager/TimersManager.cjs.map +0 -1
  59. package/dist/cjs/TimersStore/JSONLTimersStore.cjs.map +0 -1
  60. package/dist/cjs/TimersStore/TimersStore.cjs.map +0 -1
  61. /package/dist/cjs/{Log.cjs → Log.js} +0 -0
  62. /package/dist/cjs/{Log.cjs.map → Log.js.map} +0 -0
  63. /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
  64. /package/dist/cjs/{searchRoot.cjs → searchRoot.js} +0 -0
  65. /package/dist/cjs/{searchRoot.cjs.map → searchRoot.js.map} +0 -0
  66. /package/dist/cjs/{types.cjs → types.js} +0 -0
  67. /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/SUKEsann2000/eternal-timer/run_test.yml)
4
4
  ![NPM Downloads](https://img.shields.io/npm/dm/eternal-timer)
5
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/SUKEsann2000/eternal-timer)
5
6
 
6
7
  A simple and persistent timer library for Node.js. Timers are saved to a file and maintain their state even after process restart.
7
8
 
@@ -23,7 +24,7 @@ You can choose between two manager classes depending on the desired storage form
23
24
 
24
25
  ### `JSONLTimersManager` (JSON Lines)
25
26
 
26
- Use this manager to store timers in a `.jsonl` file, which allows for storing `title` and `description`.
27
+ Use this manager to store timers in a `.jsonl` file, which allows for storing `extra` data.
27
28
 
28
29
  ```javascript
29
30
  import { JSONLTimersManager } from 'eternal-timer';
@@ -33,12 +34,12 @@ async function main() {
33
34
  const manager = new JSONLTimersManager();
34
35
 
35
36
  // Create a timer (5 seconds) with a title and description
36
- const timerId = await manager.createTimer({length: 5000, title: 'My Timer', description: 'This is a test timer.'});
37
+ const timerId = await manager.createTimer({length: 5000, extra: { title: 'My Timer', description: 'This is a test timer.' }});
37
38
  console.log('Timer created:', timerId);
38
39
 
39
40
  // Monitor timers (executes when timer expires)
40
41
  const interval = await manager.checkTimers(async (timer) => {
41
- console.log('Timer expired:', timer.id, timer.title);
42
+ console.log('Timer expired:', timer.id, timer.extra?.title);
42
43
  });
43
44
 
44
45
  // Display all timers
@@ -98,25 +99,57 @@ Creates a manager for timers stored in **JSON Lines** format.
98
99
 
99
100
  - **`timerfiledir`** (optional, string): Path to the timer file. Defaults to `.timers.jsonl` in the project root.
100
101
 
101
- #### `changeTitle(id: string, newTitle: string): Promise<void>`
102
- Changes the title of an existing timer.
102
+ #### `changeExtra(id: string, newExtra: Extra): Promise<void>`
103
+ Changes the `extra` data of an existing timer.
103
104
 
104
105
  - **`id`**: The ID of the timer to modify.
105
- - **`newTitle`**: The new title for the timer.
106
+ - **`newExtra`**: The new `extra` object for the timer.
106
107
 
107
- **Returns:** A `Promise<void>` that resolves when the timer's title has been updated.
108
+ **Returns:** A `Promise<void>` that resolves when the timer's `extra` data has been updated.
108
109
 
109
110
  **Throws:** An error if: the timer with the specified ID is not found, or a file operation fails.
110
111
 
111
- #### `changeDescription(id: string, newDescription: string): Promise<void>`
112
- Changes the description of an existing timer.
112
+ #### Using the `Extra` Type Parameter
113
113
 
114
- - **`id`**: The ID of the timer to modify.
115
- - **`newDescription`**: The new description for the timer.
114
+ The `JSONLTimersManager` is a generic class that accepts a type parameter `Extra`. This allows you to define the structure of the `extra` object that will be stored with your timers. By default, `Extra` is an empty object `{}`.
116
115
 
117
- **Returns:** A `Promise<void>` that resolves when the timer's description has been updated.
116
+ **Example:** Defining and using a custom `Extra` type
118
117
 
119
- **Throws:** An error if: the timer with the specified ID is not found, or a file operation fails.
118
+ ```typescript
119
+ import { JSONLTimersManager } from 'eternal-timer';
120
+
121
+ interface MyTimerExtra {
122
+ title?: string;
123
+ description?: string;
124
+ category?: string;
125
+ }
126
+
127
+ async function main() {
128
+ // Specify MyTimerExtra as the type argument for JSONLTimersManager
129
+ const manager = new JSONLTimersManager<MyTimerExtra>();
130
+
131
+ // Create a timer with custom extra data
132
+ const timerId = await manager.createTimer({
133
+ length: 10000,
134
+ extra: {
135
+ title: 'Project Alpha Deadline',
136
+ description: 'Final submission for project Alpha.',
137
+ category: 'Work'
138
+ }
139
+ });
140
+ console.log('Timer created:', timerId);
141
+
142
+ // Retrieve and access the custom extra data
143
+ const timers = await manager.showTimers();
144
+ const myTimer = timers.find(t => t.id === timerId);
145
+ if (myTimer) {
146
+ console.log('Timer title:', myTimer.extra?.title);
147
+ console.log('Timer category:', myTimer.extra?.category);
148
+ }
149
+ }
150
+
151
+ main();
152
+ ```
120
153
 
121
154
  ### `PlainTextTimersManager`
122
155
 
@@ -139,13 +172,9 @@ Creates a new timer and saves it to the file.
139
172
  - `number` — Timer duration in milliseconds.
140
173
 
141
174
  When using `"JSONL"` storage:
142
- - `{ length: number; title?: string; description?: string }`
175
+ - `{ length: number; extra?: Extra }`
143
176
  - `length` (number): Timer duration in milliseconds.
144
- - `title` (optional, string): A title for the timer.
145
- - `description` (optional, string): A description for the timer.
146
-
147
- - `number` — Timer duration in milliseconds.
148
- ⚠ Not recommended. See [Storage Formats](#storage-formats).
177
+ - `extra` (optional, Extra): An object containing arbitrary user-defined metadata.
149
178
 
150
179
  **Returns** A `Promise<string>` that resolves to the timer's unique ID (UUID).
151
180
 
@@ -207,22 +236,22 @@ type StorageType = "JSONL" | "PlainText"
207
236
  The `Timer` object has the following structure:
208
237
 
209
238
  ```typescript
210
- type Timer<T extends StorageType> = {
239
+ type Timer<T extends StorageType, Extra extends object> = {
211
240
  id: string;
212
241
  start: number;
213
242
  stop: number;
214
243
  } & (T extends "JSONL"
215
- ? { title?: string; description?: string }
244
+ ? { extra: Extra }
216
245
  : {});
217
246
  ```
247
+ `Extra` is a generic type parameter that represents an object containing arbitrary user-defined metadata for JSONL timers. For example, it can be `{ title?: string; description?: string }`.
218
248
 
219
249
  ## Scripts
220
250
 
221
- - `npm run dev`: Run in development mode with nodemon
222
251
  - `npm run build`: Compile TypeScript
223
- - `npm start`: Run compiled JavaScript
224
252
  - `npm run test`: Test the compiled code
225
253
  - `npm run lint`: Lint all codes
254
+ - `npm run lint:fix`: Lint all codes and fix
226
255
 
227
256
  ## Storage Formats
228
257
 
@@ -9,11 +9,23 @@ import { JSONLTimersStore } from "../TimersStore/JSONLTimersStore.js";
9
9
  * - Timers are persisted in a file
10
10
  * - Expired timers are detected by polling
11
11
  */
12
- export declare class JSONLTimersManager extends TimersManager<"JSONL"> {
13
- protected TimersStore: JSONLTimersStore | null;
12
+ export declare class JSONLTimersManager<Extra extends object = object> extends TimersManager<"JSONL", Extra> {
13
+ protected TimersStore: JSONLTimersStore<Extra> | null;
14
14
  protected getDefaultFilename(): string;
15
- protected createTimersStore(): Promise<JSONLTimersStore>;
16
- changeTitle(id: string, newTitle: string): Promise<void>;
17
- changeDescription(id: string, newDescription: string): Promise<void>;
15
+ protected createTimersStore(): Promise<JSONLTimersStore<Extra>>;
16
+ protected type: "JSONL";
17
+ /**
18
+ * changeExtra
19
+ * @description Change extra field
20
+ * @param {string} id
21
+ * @param {Extra} newExtra
22
+ * @returns Promise resolving when the operation is complete
23
+ * @throws If timer with id not found or file operation fails
24
+ * @example
25
+ * const timer = await manager.createTimer({ length: 1000, extra: {author: "someone"} });
26
+ * await changeExtra(timer, {author: "SUKEsann2000"});
27
+ * // extra is changed and author will be "SUKEsann2000" instead of "someone"
28
+ */
29
+ changeExtra(id: string, newExtra: Extra): Promise<void>;
18
30
  }
19
31
  //# sourceMappingURL=JSONLTimersManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JSONLTimersManager.d.ts","sourceRoot":"","sources":["../../../src/TimersManager/JSONLTimersManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE;;;;;;;;GAQG;AACH,qBAAa,kBAAmB,SAAQ,aAAa,CAAC,OAAO,CAAC;IAC7D,UAAmB,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAQ;cAE5C,kBAAkB,IAAI,MAAM;cAItB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAI1D,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBxD,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBjF"}
1
+ {"version":3,"file":"JSONLTimersManager.d.ts","sourceRoot":"","sources":["../../../src/TimersManager/JSONLTimersManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE;;;;;;;;GAQG;AACH,qBAAa,kBAAkB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;IACnG,UAAmB,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAQ;cAEnD,kBAAkB,IAAI,MAAM;cAItB,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAI9E,UAAmB,IAAI,EAAE,OAAO,CAAoB;IAEpD;;;;;;;;;;;OAWG;IACU,WAAW,CACvB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,KAAK,GACb,OAAO,CAAC,IAAI,CAAC;CAkBhB"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JSONLTimersManager = void 0;
4
- const TimersManager_js_1 = require("./TimersManager.cjs");
5
- const JSONLTimersStore_js_1 = require("../TimersStore/JSONLTimersStore.cjs");
4
+ const TimersManager_js_1 = require("./TimersManager.js");
5
+ const JSONLTimersStore_js_1 = require("../TimersStore/JSONLTimersStore.js");
6
6
  /**
7
7
  * JSONLTimersManager
8
8
  * @description
@@ -20,7 +20,20 @@ class JSONLTimersManager extends TimersManager_js_1.TimersManager {
20
20
  async createTimersStore() {
21
21
  return new JSONLTimersStore_js_1.JSONLTimersStore(this.timerfiledir);
22
22
  }
23
- async changeTitle(id, newTitle) {
23
+ type = "JSONL";
24
+ /**
25
+ * changeExtra
26
+ * @description Change extra field
27
+ * @param {string} id
28
+ * @param {Extra} newExtra
29
+ * @returns Promise resolving when the operation is complete
30
+ * @throws If timer with id not found or file operation fails
31
+ * @example
32
+ * const timer = await manager.createTimer({ length: 1000, extra: {author: "someone"} });
33
+ * await changeExtra(timer, {author: "SUKEsann2000"});
34
+ * // extra is changed and author will be "SUKEsann2000" instead of "someone"
35
+ */
36
+ async changeExtra(id, newExtra) {
24
37
  return this.runExclusive(async () => {
25
38
  this.TimersStore ??= await this.createTimersStore();
26
39
  try {
@@ -29,28 +42,11 @@ class JSONLTimersManager extends TimersManager_js_1.TimersManager {
29
42
  if (index === -1) {
30
43
  throw new Error(`Timer with id ${id} not found`);
31
44
  }
32
- timers[index].title = newTitle;
45
+ timers[index].extra = newExtra;
33
46
  await this.TimersStore.saveTimers(timers);
34
47
  }
35
48
  catch (e) {
36
- throw new Error(`Error when changing title`, { cause: e });
37
- }
38
- });
39
- }
40
- async changeDescription(id, newDescription) {
41
- return this.runExclusive(async () => {
42
- this.TimersStore ??= await this.createTimersStore();
43
- try {
44
- const timers = await this.TimersStore.loadTimers();
45
- const index = timers?.findIndex(t => t.id === id);
46
- if (index === -1) {
47
- throw new Error(`Timer with id ${id} not found`);
48
- }
49
- timers[index].description = newDescription;
50
- await this.TimersStore.saveTimers(timers);
51
- }
52
- catch (e) {
53
- throw new Error(`Error when changing description`, { cause: e });
49
+ throw new Error(`Error when changing extra`, { cause: e });
54
50
  }
55
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,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AA9CD,gDA8CC"}
@@ -9,9 +9,10 @@ import { PlainTextTimersStore } from "../TimersStore/PlainTextTimersStore.js";
9
9
  * - Timers are persisted in a file
10
10
  * - Expired timers are detected by polling
11
11
  */
12
- export declare class PlainTextTimersManager extends TimersManager<"PlainText"> {
12
+ export declare class PlainTextTimersManager extends TimersManager<"PlainText", object> {
13
13
  protected TimersStore: PlainTextTimersStore | null;
14
14
  protected getDefaultFilename(): string;
15
15
  protected createTimersStore(): Promise<PlainTextTimersStore>;
16
+ protected type: "PlainText";
16
17
  }
17
18
  //# sourceMappingURL=PlainTextTimersManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlainTextTimersManager.d.ts","sourceRoot":"","sources":["../../../src/TimersManager/PlainTextTimersManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,SAAQ,aAAa,CAAC,WAAW,CAAC;IACrE,UAAmB,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAQ;cAEhD,kBAAkB,IAAI,MAAM;cAI/B,iBAAiB,IAAI,OAAO,CAAC,oBAAoB,CAAC;CAGlE"}
1
+ {"version":3,"file":"PlainTextTimersManager.d.ts","sourceRoot":"","sources":["../../../src/TimersManager/PlainTextTimersManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E;;;;;;;;GAQG;AACH,qBAAa,sBAAuB,SAAQ,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7E,UAAmB,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAQ;cAEhD,kBAAkB,IAAI,MAAM;cAI/B,iBAAiB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIlE,UAAmB,IAAI,EAAE,WAAW,CAAwB;CAC5D"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlainTextTimersManager = void 0;
4
- const TimersManager_js_1 = require("./TimersManager.cjs");
5
- const PlainTextTimersStore_js_1 = require("../TimersStore/PlainTextTimersStore.cjs");
4
+ const TimersManager_js_1 = require("./TimersManager.js");
5
+ const PlainTextTimersStore_js_1 = require("../TimersStore/PlainTextTimersStore.js");
6
6
  /**
7
7
  * PlainTextTimersManager
8
8
  * @description
@@ -20,6 +20,7 @@ class PlainTextTimersManager extends TimersManager_js_1.TimersManager {
20
20
  async createTimersStore() {
21
21
  return new PlainTextTimersStore_js_1.PlainTextTimersStore(this.timerfiledir);
22
22
  }
23
+ type = "PlainText";
23
24
  }
24
25
  exports.PlainTextTimersManager = PlainTextTimersManager;
25
26
  //# sourceMappingURL=PlainTextTimersManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlainTextTimersManager.js","sourceRoot":"","sources":["../../../src/TimersManager/PlainTextTimersManager.ts"],"names":[],"mappings":";;;AAAA,yDAAmD;AACnD,oFAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,gCAA0B;IAClD,WAAW,GAAgC,IAAI,CAAC;IAEhD,kBAAkB;QACpC,OAAO,SAAS,CAAC;IAClB,CAAC;IAES,KAAK,CAAC,iBAAiB;QAChC,OAAO,IAAI,8CAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC;CACD;AAVD,wDAUC"}
1
+ {"version":3,"file":"PlainTextTimersManager.js","sourceRoot":"","sources":["../../../src/TimersManager/PlainTextTimersManager.ts"],"names":[],"mappings":";;;AAAA,yDAAmD;AACnD,oFAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,gCAAkC;IAC1D,WAAW,GAAgC,IAAI,CAAC;IAEhD,kBAAkB;QACpC,OAAO,SAAS,CAAC;IAClB,CAAC;IAES,KAAK,CAAC,iBAAiB;QAChC,OAAO,IAAI,8CAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC;IAEkB,IAAI,GAAgB,WAAoB,CAAC;CAC5D;AAZD,wDAYC"}
@@ -9,18 +9,19 @@ import { TimersStore } from "../TimersStore/TimersStore.js";
9
9
  * - Timers are persisted in a file
10
10
  * - Expired timers are detected by polling
11
11
  */
12
- export declare abstract class TimersManager<T extends StorageType> {
12
+ export declare abstract class TimersManager<T extends StorageType, Extra extends object> {
13
13
  protected readonly timerfiledir: string;
14
14
  private checkLock;
15
- protected TimersStore: TimersStore<T> | null;
15
+ protected TimersStore: TimersStore<T, Extra> | null;
16
16
  private queue;
17
17
  protected runExclusive<T>(fn: () => Promise<T>): Promise<T>;
18
18
  protected abstract getDefaultFilename(): string;
19
- protected abstract createTimersStore(): Promise<TimersStore<T>>;
19
+ protected abstract createTimersStore(): Promise<TimersStore<T, Extra>>;
20
+ protected abstract type: T;
20
21
  /**
21
22
  * constructor
22
23
  * @description Initializes the TimersManager instance. If the timer file does not exist, an empty file is created.
23
- * @param options (TimersManagerOptions | string, optional) Configuration object or timer file path. If a string is provided, it is treated as the timer file path. If an object is provided, `timerfiledir` can be specified.
24
+ * @param {string} [options] (string, optional) Configuration timer file path and it is treated as the timer file path.
24
25
  * @throws If file access or creation fails
25
26
  * @example
26
27
  * const manager = new TimersManager(); // Uses default timer file path
@@ -30,7 +31,7 @@ export declare abstract class TimersManager<T extends StorageType> {
30
31
  /**
31
32
  * createTimer
32
33
  * @description Creates a new timer.
33
- * @param length Timer duration in milliseconds
34
+ * @param {{length: number, extra: Extra} | number} options Timer duration in milliseconds and extra field(only JSONL)
34
35
  * @returns Promise that resolves to the timer ID (UUID)
35
36
  * @throws If length is invalid(e.g. length < 0) or file operation fails
36
37
  * @example
@@ -38,12 +39,12 @@ export declare abstract class TimersManager<T extends StorageType> {
38
39
  * const newTimer = await manager.createTimer(5000);
39
40
  * // newTimer will be id of the timer
40
41
  */
41
- createTimer(options: CreateTimerOptions<T>): Promise<string>;
42
+ createTimer(options: CreateTimerOptions<T, Extra>): Promise<string>;
42
43
  /**
43
44
  * removeTimer
44
45
  * @description Removes a timer by ID.
45
- * @param id ID of the timer to remove
46
- * @returns void
46
+ * @param {string} id ID of the timer to remove
47
+ * @returns Promise resolving when the operation is complete
47
48
  * @throws If file operation fails
48
49
  * @example
49
50
  * await manager.removeTimer(id);
@@ -54,16 +55,16 @@ export declare abstract class TimersManager<T extends StorageType> {
54
55
  * @description Starts monitoring timers at the specified interval.
55
56
  * When a timer expires, the provided `callback` is invoked with the timer.
56
57
  * The callback is awaited before the next processing cycle continues.
57
- * @param callback Function invoked when an expired timer is detected (called asynchronously)
58
- * @param interval (number, optional): Check interval in milliseconds (default: 200ms)
58
+ * @param {(timer: Timer<T, Extra>) => void | Promise<void>} callback Function invoked when an expired timer is detected (called asynchronously)
59
+ * @param {number} [interval=200] (number, optional): Check interval in milliseconds (default: 200ms)
59
60
  * @throws If file operation fails
60
- * @returns (Promise<NodeJS.Timeout>) intervalId interval id of checkTimers
61
+ * @returns {Promise<NodeJS.Timeout>} intervalId interval id of checkTimers
61
62
  * @example
62
63
  * const interval = await manager.checkTimers((timer) => {
63
64
  * console.log(`A timer was stopped: ${timer.id}`);
64
65
  * });
65
66
  */
66
- checkTimers(callback: (timer: Timer<T>) => void | Promise<void>, interval?: number): Promise<NodeJS.Timeout>;
67
+ checkTimers(callback: (timer: Timer<T, Extra>) => void | Promise<void>, interval?: number): Promise<NodeJS.Timeout>;
67
68
  /**
68
69
  * showTimers
69
70
  * @description Retrieves all active timers.
@@ -73,12 +74,12 @@ export declare abstract class TimersManager<T extends StorageType> {
73
74
  * const timers = await manager.showTimers();
74
75
  * console.log(JSON.stringify(timers))
75
76
  */
76
- showTimers(): Promise<Timer<T>[]>;
77
+ showTimers(): Promise<Timer<T, Extra>[]>;
77
78
  /**
78
79
  * adjustRemainingTime
79
80
  * @description Adjusts the remaining time of a timer.
80
- * @param id ID of the timer to modify
81
- * @param delay Delay in milliseconds to add/subtract from the remaining time
81
+ * @param {string} id ID of the timer to modify
82
+ * @param {number} delay Delay in milliseconds to add/subtract from the remaining time
82
83
  * @returns Promise resolving when the operation is complete
83
84
  * @throws If file operation fails
84
85
  */
@@ -1 +1 @@
1
- {"version":3,"file":"TimersManager.d.ts","sourceRoot":"","sources":["../../../src/TimersManager/TimersManager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAG5D;;;;;;;;GAQG;AACH,8BAAsB,aAAa,CAAC,CAAC,SAAS,WAAW;IACxD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IACxC,OAAO,CAAC,SAAS,CAAkB;IAEnC,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAQ;IAEpD,OAAO,CAAC,KAAK,CAAoC;IACjD,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAM9C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,MAAM;IAC/C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAE/D;;;;;;;;QAQO;gBAEN,OAAO,CAAC,EAAE,MAAM;IAcjB;;;;;;;;;;OAUM;IACO,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BzE;;;;;;;;OAQM;IACO,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBnD;;;;;;;;;;;;;OAaM;IACO,WAA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EAAE,MAAM;IAcjB;;;;;;;;;;OAUM;IACO,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IA+BhF;;;;;;;;OAQM;IACO,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBnD;;;;;;;;;;;;;OAaM;IACO,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;IAuDrI;;;;;;;;OAQM;IACO,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;IAQrD;;;;;;;QAOO;IACM,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB1E"}
@@ -7,8 +7,8 @@ exports.TimersManager = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const uuid_1 = require("uuid");
10
- const searchRoot_js_1 = __importDefault(require("../searchRoot.cjs"));
11
- const Log_js_1 = require("../Log.cjs");
10
+ const searchRoot_js_1 = __importDefault(require("../searchRoot.js"));
11
+ const Log_js_1 = require("../Log.js");
12
12
  /**
13
13
  * TimersManager
14
14
  * @description
@@ -31,7 +31,7 @@ class TimersManager {
31
31
  /**
32
32
  * constructor
33
33
  * @description Initializes the TimersManager instance. If the timer file does not exist, an empty file is created.
34
- * @param options (TimersManagerOptions | string, optional) Configuration object or timer file path. If a string is provided, it is treated as the timer file path. If an object is provided, `timerfiledir` can be specified.
34
+ * @param {string} [options] (string, optional) Configuration timer file path and it is treated as the timer file path.
35
35
  * @throws If file access or creation fails
36
36
  * @example
37
37
  * const manager = new TimersManager(); // Uses default timer file path
@@ -53,7 +53,7 @@ class TimersManager {
53
53
  /**
54
54
  * createTimer
55
55
  * @description Creates a new timer.
56
- * @param length Timer duration in milliseconds
56
+ * @param {{length: number, extra: Extra} | number} options Timer duration in milliseconds and extra field(only JSONL)
57
57
  * @returns Promise that resolves to the timer ID (UUID)
58
58
  * @throws If length is invalid(e.g. length < 0) or file operation fails
59
59
  * @example
@@ -64,6 +64,9 @@ class TimersManager {
64
64
  async createTimer(options) {
65
65
  return this.runExclusive(async () => {
66
66
  this.TimersStore ??= await this.createTimersStore();
67
+ if (this.type === "JSONL" && typeof options === "number") {
68
+ throw new Error(`Cannot create timer without extra fields in JSONL`);
69
+ }
67
70
  let length = typeof options === "object" ? options.length : options;
68
71
  if (length < 0)
69
72
  throw new Error(`Invalid length: ${length}`);
@@ -75,8 +78,9 @@ class TimersManager {
75
78
  id,
76
79
  start: now,
77
80
  stop: stopTime,
78
- ...(typeof options === "object" && options.title !== undefined && { title: options.title }),
79
- ...(typeof options === "object" && options.description !== undefined && { description: options.description }),
81
+ ...(options && typeof options === "object" && options.extra !== undefined
82
+ ? { extra: options.extra }
83
+ : {}),
80
84
  };
81
85
  await this.TimersStore.appendTimer(newTimerData);
82
86
  return id;
@@ -85,8 +89,8 @@ class TimersManager {
85
89
  /**
86
90
  * removeTimer
87
91
  * @description Removes a timer by ID.
88
- * @param id ID of the timer to remove
89
- * @returns void
92
+ * @param {string} id ID of the timer to remove
93
+ * @returns Promise resolving when the operation is complete
90
94
  * @throws If file operation fails
91
95
  * @example
92
96
  * await manager.removeTimer(id);
@@ -109,10 +113,10 @@ class TimersManager {
109
113
  * @description Starts monitoring timers at the specified interval.
110
114
  * When a timer expires, the provided `callback` is invoked with the timer.
111
115
  * The callback is awaited before the next processing cycle continues.
112
- * @param callback Function invoked when an expired timer is detected (called asynchronously)
113
- * @param interval (number, optional): Check interval in milliseconds (default: 200ms)
116
+ * @param {(timer: Timer<T, Extra>) => void | Promise<void>} callback Function invoked when an expired timer is detected (called asynchronously)
117
+ * @param {number} [interval=200] (number, optional): Check interval in milliseconds (default: 200ms)
114
118
  * @throws If file operation fails
115
- * @returns (Promise<NodeJS.Timeout>) intervalId interval id of checkTimers
119
+ * @returns {Promise<NodeJS.Timeout>} intervalId interval id of checkTimers
116
120
  * @example
117
121
  * const interval = await manager.checkTimers((timer) => {
118
122
  * console.log(`A timer was stopped: ${timer.id}`);
@@ -183,8 +187,8 @@ class TimersManager {
183
187
  /**
184
188
  * adjustRemainingTime
185
189
  * @description Adjusts the remaining time of a timer.
186
- * @param id ID of the timer to modify
187
- * @param delay Delay in milliseconds to add/subtract from the remaining time
190
+ * @param {string} id ID of the timer to modify
191
+ * @param {number} delay Delay in milliseconds to add/subtract from the remaining time
188
192
  * @returns Promise resolving when the operation is complete
189
193
  * @throws If file operation fails
190
194
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimersManager.js","sourceRoot":"","sources":["../../../src/TimersManager/TimersManager.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,+BAAoC;AAEpC,qEAA0C;AAG1C,sCAAgC;AAEhC;;;;;;;;GAQG;AACH,MAAsB,aAAa;IACf,YAAY,CAAS;IAChC,SAAS,GAAY,KAAK,CAAC;IAEzB,WAAW,GAAiC,IAAI,CAAC;IAEnD,KAAK,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IACvC,YAAY,CAAI,EAAoB;QAC7C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACxC,OAAO,CAAC,CAAC;IACV,CAAC;IAMD;;;;;;;;QAQO;IACP,YACC,OAAgB;QAEhB,MAAM,OAAO,GAAG,IAAA,uBAAU,GAAE,CAAC;QAC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IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;YAChD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,CAAC;YAEpD,KAAK,CAAC,IAAI,GAAG,GAAG,GAAG,YAAY,CAAC;YAChC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;YACtB,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC1C,OAAO;QACR,CAAC,CAAC,CAAC;IACH,CAAC;CACF;AAhOD,sCAgOC"}
@@ -1,6 +1,6 @@
1
1
  import type { Timer } from "../types.js";
2
2
  import { TimersStore } from "./TimersStore.js";
3
- export declare class JSONLTimersStore extends TimersStore<"JSONL"> {
3
+ export declare class JSONLTimersStore<Extra extends object> extends TimersStore<"JSONL", Extra> {
4
4
  constructor(timerfile: string);
5
5
  /**
6
6
  * checkTimerfileSyntax
@@ -9,8 +9,8 @@ export declare class JSONLTimersStore extends TimersStore<"JSONL"> {
9
9
  * @returns void
10
10
  * @throws If syntax is invalid
11
11
  */
12
- protected checkTimerfileSyntax(timers: Timer<"JSONL">[]): Promise<void>;
13
- toStringifyTimers(timers: Timer<"JSONL">[]): string;
14
- parseTimers(data: string): Timer<"JSONL">[];
12
+ protected checkTimerfileSyntax(timers: Timer<"JSONL", Extra>[]): Promise<void>;
13
+ toStringifyTimers(timers: Timer<"JSONL", Extra>[]): string;
14
+ parseTimers(data: string): Timer<"JSONL", Extra>[];
15
15
  }
16
16
  //# sourceMappingURL=JSONLTimersStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"JSONLTimersStore.d.ts","sourceRoot":"","sources":["../../../src/TimersStore/JSONLTimersStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAiB,SAAQ,WAAW,CAAC,OAAO,CAAC;gBAGxD,SAAS,EAAE,MAAM;IAKlB;;;;;;OAMG;cACsB,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IActE,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM;IAOnD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE;CAM3D"}
1
+ {"version":3,"file":"JSONLTimersStore.d.ts","sourceRoot":"","sources":["../../../src/TimersStore/JSONLTimersStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,gBAAgB,CAAC,KAAK,SAAS,MAAM,CAAE,SAAQ,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC;gBAGrF,SAAS,EAAE,MAAM;IAKlB;;;;;;OAMG;cACsB,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7E,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,GAAG,MAAM;IAO1D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;CAMlE"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.JSONLTimersStore = void 0;
4
4
  const uuid_1 = require("uuid");
5
- const TimersStore_js_1 = require("./TimersStore.cjs");
5
+ const TimersStore_js_1 = require("./TimersStore.js");
6
6
  class JSONLTimersStore extends TimersStore_js_1.TimersStore {
7
7
  constructor(timerfile) {
8
8
  super(timerfile);
@@ -19,6 +19,10 @@ class JSONLTimersStore extends TimersStore_js_1.TimersStore {
19
19
  throw new Error(`Timer file's syntax is wrong`);
20
20
  };
21
21
  for (const timer of timers) {
22
+ if (Object.keys(timer).length !== 4)
23
+ throwing();
24
+ if (Object.keys(timer).length !== 4)
25
+ throwing();
22
26
  if (!timer.id || !(0, uuid_1.validate)(timer.id))
23
27
  throwing();
24
28
  if (!timer.start || typeof timer.start !== "number")
@@ -27,9 +31,7 @@ class JSONLTimersStore extends TimersStore_js_1.TimersStore {
27
31
  throwing();
28
32
  if (timer.start > timer.stop)
29
33
  throwing();
30
- if (timer.title && typeof timer.title !== "string")
31
- throwing();
32
- if (timer.description && typeof timer.description !== "string")
34
+ if (!timer.extra || typeof timer.extra !== "object")
33
35
  throwing();
34
36
  }
35
37
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JSONLTimersStore.js","sourceRoot":"","sources":["../../../src/TimersStore/JSONLTimersStore.ts"],"names":[],"mappings":";;;AAAA,+BAAgC;AAGhC,qDAA+C;AAE/C,MAAa,gBAAuC,SAAQ,4BAA2B;IAEtF,YACC,SAAiB;QAEjB,KAAK,CAAC,SAAS,CAAC,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACgB,KAAK,CAAC,oBAAoB,CAAC,MAA+B;QAC5E,MAAM,QAAQ,GAAG,GAAG,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAE,QAAQ,EAAE,CAAC;YAChD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAE,QAAQ,EAAE,CAAC;YAChD,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,IAAA,eAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;gBAAE,QAAQ,EAAE,CAAC;YACjD,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;gBAAE,QAAQ,EAAE,CAAC;YAChE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;gBAAE,QAAQ,EAAE,CAAC;YAC9D,IAAI,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI;gBAAE,QAAQ,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;gBAAE,QAAQ,EAAE,CAAC;QACjE,CAAC;IACF,CAAC;IAEe,iBAAiB,CAAC,MAA+B;QAChE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,EAAE,CAAC;QACX,CAAC;QACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAEe,WAAW,CAAC,IAAY;QACvC,OAAO,IAAI;aACT,KAAK,CAAC,OAAO,CAAC;aACd,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAA0B,CAAC,CAAC;IAC5D,CAAC;CACD;AA3CD,4CA2CC"}
@@ -1,6 +1,6 @@
1
1
  import type { Timer } from "../types.js";
2
2
  import { TimersStore } from "./TimersStore.js";
3
- export declare class PlainTextTimersStore extends TimersStore<"PlainText"> {
3
+ export declare class PlainTextTimersStore extends TimersStore<"PlainText", object> {
4
4
  constructor(timerfile: string);
5
5
  /**
6
6
  * checkTimerfileSyntax
@@ -9,8 +9,8 @@ export declare class PlainTextTimersStore extends TimersStore<"PlainText"> {
9
9
  * @returns void
10
10
  * @throws If syntax is invalid
11
11
  */
12
- protected checkTimerfileSyntax(timers: Timer<"PlainText">[]): Promise<void>;
13
- toStringifyTimers(timers: Timer<"PlainText">[]): string;
14
- parseTimers(data: string): Timer<"PlainText">[];
12
+ protected checkTimerfileSyntax(timers: Timer<"PlainText", object>[]): Promise<void>;
13
+ toStringifyTimers(timers: Timer<"PlainText", object>[]): string;
14
+ parseTimers(data: string): Timer<"PlainText", object>[];
15
15
  }
16
16
  //# sourceMappingURL=PlainTextTimersStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlainTextTimersStore.d.ts","sourceRoot":"","sources":["../../../src/TimersStore/PlainTextTimersStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,oBAAqB,SAAQ,WAAW,CAAC,WAAW,CAAC;gBAGhE,SAAS,EAAE,MAAM;IAKlB;;;;;;OAMM;cACmB,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAc1E,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE,GAAG,MAAM;IAOvD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,EAAE;CAa/D"}
1
+ {"version":3,"file":"PlainTextTimersStore.d.ts","sourceRoot":"","sources":["../../../src/TimersStore/PlainTextTimersStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,oBAAqB,SAAQ,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC;gBAGxE,SAAS,EAAE,MAAM;IAKlB;;;;;;OAMM;cACmB,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAclF,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,MAAM;IAO/D,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE;CAavE"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PlainTextTimersStore = void 0;
4
4
  const uuid_1 = require("uuid");
5
- const TimersStore_js_1 = require("./TimersStore.cjs");
5
+ const TimersStore_js_1 = require("./TimersStore.js");
6
6
  class PlainTextTimersStore extends TimersStore_js_1.TimersStore {
7
7
  constructor(timerfile) {
8
8
  super(timerfile);
@@ -1 +1 @@
1
- {"version":3,"file":"PlainTextTimersStore.js","sourceRoot":"","sources":["../../../src/TimersStore/PlainTextTimersStore.ts"],"names":[],"mappings":";;;AAAA,+BAAgC;AAGhC,qDAA+C;AAE/C,MAAa,oBAAqB,SAAQ,4BAAwB;IAEjE,YACC,SAAiB;QAEjB,KAAK,CAAC,SAAS,CAAC,CAAC;IAClB,CAAC;IAED;;;;;;OAMM;IACa,KAAK,CAAC,oBAAoB,CAAC,MAA4B;QACzE,MAAM,QAAQ,GAAG,GAAG,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC;gBAAE,QAAQ,EAAE,CAAC;YAChD,IAAI,CAAC,IAAA,eAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;gBAAE,QAAQ,EAAE,CAAC;YACpC,IAAI,KAAK,CAA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AM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACb,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAChD,OAAO;gBACN,EAAE,EAAE,EAAG;gBACP,KAAK,EAAE,MAAM,CAAC,QAAS,CAAC;gBACxB,IAAI,EAAE,MAAM,CAAC,OAAQ,CAAC;aACQ,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;CACD;AAjDD,oDAiDC"}
@@ -1,12 +1,12 @@
1
1
  import type { StorageType, Timer } from "../types.js";
2
- export declare abstract class TimersStore<T extends StorageType> {
2
+ export declare abstract class TimersStore<T extends StorageType, Extra extends object> {
3
3
  protected readonly timerfile: string;
4
4
  protected constructor(timerfile: string);
5
- loadTimers(): Promise<Timer<T>[]>;
6
- saveTimers(timers: Timer<T>[]): Promise<void>;
7
- appendTimer(timer: Timer<T>): Promise<void>;
8
- protected abstract checkTimerfileSyntax(timers: Timer<T>[]): Promise<void>;
9
- abstract toStringifyTimers(timers: Timer<T>[]): string;
10
- abstract parseTimers(data: string): Timer<T>[];
5
+ loadTimers(): Promise<Timer<T, Extra>[]>;
6
+ saveTimers(timers: Timer<T, Extra>[]): Promise<void>;
7
+ appendTimer(timer: Timer<T, Extra>): Promise<void>;
8
+ protected abstract checkTimerfileSyntax(timers: Timer<T, Extra>[]): Promise<void>;
9
+ abstract toStringifyTimers(timers: Timer<T, Extra>[]): string;
10
+ abstract parseTimers(data: string): Timer<T, Extra>[];
11
11
  }
12
12
  //# sourceMappingURL=TimersStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimersStore.d.ts","sourceRoot":"","sources":["../../../src/TimersStore/TimersStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAA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