@twin.org/background-task-scheduler 0.0.3-next.4 → 0.0.3-next.6

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
@@ -1,6 +1,6 @@
1
1
  # TWIN Background Task Scheduler
2
2
 
3
- Schedule background tasks to run at a specific interval or time.
3
+ This package is part of the background task toolkit and helps build reliable asynchronous workflows in TWIN applications.
4
4
 
5
5
  ## Installation
6
6
 
package/docs/changelog.md CHANGED
@@ -1,11 +1,39 @@
1
1
  # Changelog
2
2
 
3
- ## [0.0.3-next.4](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.3-next.3...background-task-scheduler-v0.0.3-next.4) (2026-02-23)
3
+ ## [0.0.3-next.6](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.5...background-task-scheduler-v0.0.3-next.6) (2026-05-11)
4
4
 
5
5
 
6
6
  ### Features
7
7
 
8
- * multi-instance lock ([#39](https://github.com/twinfoundation/background-task/issues/39)) ([7dcd434](https://github.com/twinfoundation/background-task/commit/7dcd434da5e3d1645b6fcd19ed34be4e628e50de))
8
+ * typescript 6 update ([e3f2727](https://github.com/iotaledger/twin-background-task/commit/e3f272783e0de7cf4d31f3e84a8e6f5ff633961b))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/background-task-models bumped from 0.0.3-next.5 to 0.0.3-next.6
16
+
17
+ ## [0.0.3-next.5](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.4...background-task-scheduler-v0.0.3-next.5) (2026-04-10)
18
+
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ * **background-task-scheduler:** Synchronize repo versions
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/background-task-models bumped from 0.0.3-next.4 to 0.0.3-next.5
30
+
31
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.3...background-task-scheduler-v0.0.3-next.4) (2026-02-23)
32
+
33
+
34
+ ### Features
35
+
36
+ * multi-instance lock ([#39](https://github.com/iotaledger/twin-background-task/issues/39)) ([7dcd434](https://github.com/iotaledger/twin-background-task/commit/7dcd434da5e3d1645b6fcd19ed34be4e628e50de))
9
37
 
10
38
 
11
39
  ### Dependencies
@@ -14,7 +42,7 @@
14
42
  * dependencies
15
43
  * @twin.org/background-task-models bumped from 0.0.3-next.3 to 0.0.3-next.4
16
44
 
17
- ## [0.0.3-next.3](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.3-next.2...background-task-scheduler-v0.0.3-next.3) (2026-01-07)
45
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.2...background-task-scheduler-v0.0.3-next.3) (2026-01-07)
18
46
 
19
47
 
20
48
  ### Miscellaneous Chores
@@ -28,7 +56,7 @@
28
56
  * dependencies
29
57
  * @twin.org/background-task-models bumped from 0.0.3-next.2 to 0.0.3-next.3
30
58
 
31
- ## [0.0.3-next.2](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.3-next.1...background-task-scheduler-v0.0.3-next.2) (2025-11-28)
59
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.1...background-task-scheduler-v0.0.3-next.2) (2025-11-28)
32
60
 
33
61
 
34
62
  ### Miscellaneous Chores
@@ -42,26 +70,26 @@
42
70
  * dependencies
43
71
  * @twin.org/background-task-models bumped from 0.0.3-next.1 to 0.0.3-next.2
44
72
 
45
- ## [0.0.3-next.1](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.3-next.0...background-task-scheduler-v0.0.3-next.1) (2025-11-11)
73
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.0...background-task-scheduler-v0.0.3-next.1) (2025-11-11)
46
74
 
47
75
 
48
76
  ### Features
49
77
 
50
- * add context id features ([#29](https://github.com/twinfoundation/background-task/issues/29)) ([46ede49](https://github.com/twinfoundation/background-task/commit/46ede49a51a4955fe1530e645a66f0073db9a1fd))
51
- * add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
52
- * add validate-locales ([968cbf9](https://github.com/twinfoundation/background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
53
- * background tasks immediately trigger ([a0a847b](https://github.com/twinfoundation/background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
54
- * eslint migration to flat config ([6c9136c](https://github.com/twinfoundation/background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
55
- * remove unused parameters ([1028b3c](https://github.com/twinfoundation/background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
56
- * rename task scheduler component ([2f8aa59](https://github.com/twinfoundation/background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
57
- * rename task scheduler component to service ([f097a98](https://github.com/twinfoundation/background-task/commit/f097a988c9ee0795aa55d74deda616365ec4ffb1))
58
- * update framework core ([a068098](https://github.com/twinfoundation/background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
59
- * update IComponent signatures ([e1a79bc](https://github.com/twinfoundation/background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
78
+ * add context id features ([#29](https://github.com/iotaledger/twin-background-task/issues/29)) ([46ede49](https://github.com/iotaledger/twin-background-task/commit/46ede49a51a4955fe1530e645a66f0073db9a1fd))
79
+ * add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
80
+ * add validate-locales ([968cbf9](https://github.com/iotaledger/twin-background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
81
+ * background tasks immediately trigger ([a0a847b](https://github.com/iotaledger/twin-background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
82
+ * eslint migration to flat config ([6c9136c](https://github.com/iotaledger/twin-background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
83
+ * remove unused parameters ([1028b3c](https://github.com/iotaledger/twin-background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
84
+ * rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
85
+ * rename task scheduler component to service ([f097a98](https://github.com/iotaledger/twin-background-task/commit/f097a988c9ee0795aa55d74deda616365ec4ffb1))
86
+ * update framework core ([a068098](https://github.com/iotaledger/twin-background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
87
+ * update IComponent signatures ([e1a79bc](https://github.com/iotaledger/twin-background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
60
88
 
61
89
 
62
90
  ### Bug Fixes
63
91
 
64
- * models import ([c830b0d](https://github.com/twinfoundation/background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
92
+ * models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
65
93
 
66
94
 
67
95
  ### Dependencies
@@ -70,12 +98,12 @@
70
98
  * dependencies
71
99
  * @twin.org/background-task-models bumped from 0.0.3-next.0 to 0.0.3-next.1
72
100
 
73
- ## [0.0.2-next.9](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.8...background-task-scheduler-v0.0.2-next.9) (2025-10-09)
101
+ ## [0.0.2-next.9](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.8...background-task-scheduler-v0.0.2-next.9) (2025-10-09)
74
102
 
75
103
 
76
104
  ### Features
77
105
 
78
- * add validate-locales ([968cbf9](https://github.com/twinfoundation/background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
106
+ * add validate-locales ([968cbf9](https://github.com/iotaledger/twin-background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
79
107
 
80
108
 
81
109
  ### Dependencies
@@ -84,12 +112,12 @@
84
112
  * dependencies
85
113
  * @twin.org/background-task-models bumped from 0.0.2-next.8 to 0.0.2-next.9
86
114
 
87
- ## [0.0.2-next.8](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.7...background-task-scheduler-v0.0.2-next.8) (2025-09-29)
115
+ ## [0.0.2-next.8](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.7...background-task-scheduler-v0.0.2-next.8) (2025-09-29)
88
116
 
89
117
 
90
118
  ### Features
91
119
 
92
- * update IComponent signatures ([e1a79bc](https://github.com/twinfoundation/background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
120
+ * update IComponent signatures ([e1a79bc](https://github.com/iotaledger/twin-background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
93
121
 
94
122
 
95
123
  ### Dependencies
@@ -98,12 +126,12 @@
98
126
  * dependencies
99
127
  * @twin.org/background-task-models bumped from 0.0.2-next.7 to 0.0.2-next.8
100
128
 
101
- ## [0.0.2-next.7](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.6...background-task-scheduler-v0.0.2-next.7) (2025-08-29)
129
+ ## [0.0.2-next.7](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.6...background-task-scheduler-v0.0.2-next.7) (2025-08-29)
102
130
 
103
131
 
104
132
  ### Features
105
133
 
106
- * eslint migration to flat config ([6c9136c](https://github.com/twinfoundation/background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
134
+ * eslint migration to flat config ([6c9136c](https://github.com/iotaledger/twin-background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
107
135
 
108
136
 
109
137
  ### Dependencies
@@ -112,12 +140,12 @@
112
140
  * dependencies
113
141
  * @twin.org/background-task-models bumped from 0.0.2-next.6 to 0.0.2-next.7
114
142
 
115
- ## [0.0.2-next.6](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.5...background-task-scheduler-v0.0.2-next.6) (2025-08-22)
143
+ ## [0.0.2-next.6](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.5...background-task-scheduler-v0.0.2-next.6) (2025-08-22)
116
144
 
117
145
 
118
146
  ### Features
119
147
 
120
- * remove unused parameters ([1028b3c](https://github.com/twinfoundation/background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
148
+ * remove unused parameters ([1028b3c](https://github.com/iotaledger/twin-background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
121
149
 
122
150
 
123
151
  ### Dependencies
@@ -126,12 +154,12 @@
126
154
  * dependencies
127
155
  * @twin.org/background-task-models bumped from 0.0.2-next.5 to 0.0.2-next.6
128
156
 
129
- ## [0.0.2-next.5](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.4...background-task-scheduler-v0.0.2-next.5) (2025-08-20)
157
+ ## [0.0.2-next.5](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.4...background-task-scheduler-v0.0.2-next.5) (2025-08-20)
130
158
 
131
159
 
132
160
  ### Features
133
161
 
134
- * update framework core ([a068098](https://github.com/twinfoundation/background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
162
+ * update framework core ([a068098](https://github.com/iotaledger/twin-background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
135
163
 
136
164
 
137
165
  ### Dependencies
@@ -140,12 +168,12 @@
140
168
  * dependencies
141
169
  * @twin.org/background-task-models bumped from 0.0.2-next.4 to 0.0.2-next.5
142
170
 
143
- ## [0.0.2-next.4](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.3...background-task-scheduler-v0.0.2-next.4) (2025-07-23)
171
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.3...background-task-scheduler-v0.0.2-next.4) (2025-07-23)
144
172
 
145
173
 
146
174
  ### Features
147
175
 
148
- * background tasks immediately trigger ([a0a847b](https://github.com/twinfoundation/background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
176
+ * background tasks immediately trigger ([a0a847b](https://github.com/iotaledger/twin-background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
149
177
 
150
178
 
151
179
  ### Dependencies
@@ -154,12 +182,12 @@
154
182
  * dependencies
155
183
  * @twin.org/background-task-models bumped from 0.0.2-next.3 to 0.0.2-next.4
156
184
 
157
- ## [0.0.2-next.3](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.2...background-task-scheduler-v0.0.2-next.3) (2025-07-21)
185
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.2...background-task-scheduler-v0.0.2-next.3) (2025-07-21)
158
186
 
159
187
 
160
188
  ### Features
161
189
 
162
- * rename task scheduler component to service ([f097a98](https://github.com/twinfoundation/background-task/commit/f097a988c9ee0795aa55d74deda616365ec4ffb1))
190
+ * rename task scheduler component to service ([f097a98](https://github.com/iotaledger/twin-background-task/commit/f097a988c9ee0795aa55d74deda616365ec4ffb1))
163
191
 
164
192
 
165
193
  ### Dependencies
@@ -168,18 +196,18 @@
168
196
  * dependencies
169
197
  * @twin.org/background-task-models bumped from 0.0.2-next.2 to 0.0.2-next.3
170
198
 
171
- ## [0.0.2-next.2](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.1...background-task-scheduler-v0.0.2-next.2) (2025-07-09)
199
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.1...background-task-scheduler-v0.0.2-next.2) (2025-07-09)
172
200
 
173
201
 
174
202
  ### Features
175
203
 
176
- * add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
177
- * rename task scheduler component ([2f8aa59](https://github.com/twinfoundation/background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
204
+ * add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
205
+ * rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
178
206
 
179
207
 
180
208
  ### Bug Fixes
181
209
 
182
- * models import ([c830b0d](https://github.com/twinfoundation/background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
210
+ * models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
183
211
 
184
212
 
185
213
  ### Dependencies
@@ -188,18 +216,18 @@
188
216
  * dependencies
189
217
  * @twin.org/background-task-models bumped from 0.0.2-next.1 to 0.0.2-next.2
190
218
 
191
- ## [0.0.2-next.1](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.2-next.0...background-task-scheduler-v0.0.2-next.1) (2025-07-09)
219
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.2-next.0...background-task-scheduler-v0.0.2-next.1) (2025-07-09)
192
220
 
193
221
 
194
222
  ### Features
195
223
 
196
- * add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
197
- * rename task scheduler component ([2f8aa59](https://github.com/twinfoundation/background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
224
+ * add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
225
+ * rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
198
226
 
199
227
 
200
228
  ### Bug Fixes
201
229
 
202
- * models import ([c830b0d](https://github.com/twinfoundation/background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
230
+ * models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
203
231
 
204
232
 
205
233
  ### Dependencies
@@ -213,7 +241,7 @@
213
241
 
214
242
  ### Features
215
243
 
216
- * release to production ([7ce9896](https://github.com/twinfoundation/background-task/commit/7ce989659e6819f05655c86b1bda2a265af5d281))
244
+ * release to production ([7ce9896](https://github.com/iotaledger/twin-background-task/commit/7ce989659e6819f05655c86b1bda2a265af5d281))
217
245
 
218
246
 
219
247
  ### Dependencies
@@ -222,12 +250,12 @@
222
250
  * dependencies
223
251
  * @twin.org/background-task-models bumped from ^0.0.0 to ^0.0.1
224
252
 
225
- ## [0.0.1-next.21](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.1-next.20...background-task-scheduler-v0.0.1-next.21) (2025-06-23)
253
+ ## [0.0.1-next.21](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.1-next.20...background-task-scheduler-v0.0.1-next.21) (2025-06-23)
226
254
 
227
255
 
228
256
  ### Features
229
257
 
230
- * rename task scheduler component ([2f8aa59](https://github.com/twinfoundation/background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
258
+ * rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
231
259
 
232
260
 
233
261
  ### Dependencies
@@ -236,17 +264,17 @@
236
264
  * dependencies
237
265
  * @twin.org/background-task-models bumped from 0.0.1-next.20 to 0.0.1-next.21
238
266
 
239
- ## [0.0.1-next.20](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.1-next.19...background-task-scheduler-v0.0.1-next.20) (2025-06-23)
267
+ ## [0.0.1-next.20](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.1-next.19...background-task-scheduler-v0.0.1-next.20) (2025-06-23)
240
268
 
241
269
 
242
270
  ### Features
243
271
 
244
- * add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
272
+ * add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
245
273
 
246
274
 
247
275
  ### Bug Fixes
248
276
 
249
- * models import ([c830b0d](https://github.com/twinfoundation/background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
277
+ * models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
250
278
 
251
279
 
252
280
  ### Dependencies
@@ -255,12 +283,12 @@
255
283
  * dependencies
256
284
  * @twin.org/background-task-models bumped from 0.0.1-next.19 to 0.0.1-next.20
257
285
 
258
- ## [0.0.1-next.19](https://github.com/twinfoundation/background-task/compare/background-task-scheduler-v0.0.1-next.18...background-task-scheduler-v0.0.1-next.19) (2025-06-23)
286
+ ## [0.0.1-next.19](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.1-next.18...background-task-scheduler-v0.0.1-next.19) (2025-06-23)
259
287
 
260
288
 
261
289
  ### Features
262
290
 
263
- * add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
291
+ * add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
264
292
 
265
293
 
266
294
  ### Dependencies
@@ -269,4 +297,4 @@
269
297
  * dependencies
270
298
  * @twin.org/background-task-models bumped from 0.0.1-next.18 to 0.0.1-next.19
271
299
 
272
- ## @twin.org/background-task-scheduler - Changelog
300
+ ## Changelog
package/docs/examples.md CHANGED
@@ -1 +1,95 @@
1
- # @twin.org/background-task-scheduler - Examples
1
+ # Background Task Scheduler Examples
2
+
3
+ Use these snippets to configure recurring schedules and monitor trigger state for background work.
4
+
5
+ ## TaskSchedulerService
6
+
7
+ ```typescript
8
+ import { TaskSchedulerService } from '@twin.org/background-task-scheduler';
9
+
10
+ const scheduler = new TaskSchedulerService({
11
+ config: {
12
+ intervalMs: 10000,
13
+ stalledTaskTimeoutMs: 120000
14
+ }
15
+ });
16
+
17
+ console.log(scheduler.className()); // TaskSchedulerService
18
+ ```
19
+
20
+ ```typescript
21
+ import { TaskSchedulerService } from '@twin.org/background-task-scheduler';
22
+
23
+ const scheduler = new TaskSchedulerService();
24
+ const taskId = 'report-refresh';
25
+
26
+ await scheduler.addTask(
27
+ taskId,
28
+ [
29
+ {
30
+ nextTriggerTime: Date.now() + 5000,
31
+ intervalMinutes: 10
32
+ },
33
+ {
34
+ nextTriggerTime: Date.now() + 30000,
35
+ intervalHours: 1
36
+ }
37
+ ],
38
+ async () => {
39
+ const runAt = new Date().toISOString();
40
+ console.log('report-refresh runAt', runAt); // report-refresh runAt 2026-03-09T10:45:05.000Z
41
+ }
42
+ );
43
+
44
+ const info = await scheduler.tasksInfo();
45
+ console.log(info.tasks[taskId].length); // 2
46
+ ```
47
+
48
+ ```typescript
49
+ import { TaskSchedulerService } from '@twin.org/background-task-scheduler';
50
+
51
+ const scheduler = new TaskSchedulerService();
52
+ const taskId = 'cache-prune';
53
+
54
+ await scheduler.addTask(
55
+ taskId,
56
+ [
57
+ {
58
+ nextTriggerTime: Date.now() + 1000,
59
+ intervalMinutes: 5
60
+ }
61
+ ],
62
+ async () => {
63
+ const runAt = new Date().toISOString();
64
+ console.log('cache-prune runAt', runAt); // cache-prune runAt 2026-03-09T10:45:01.000Z
65
+ }
66
+ );
67
+
68
+ await scheduler.removeTask(taskId);
69
+
70
+ const infoAfterRemoval = await scheduler.tasksInfo();
71
+ console.log(taskId in infoAfterRemoval.tasks); // false
72
+
73
+ await scheduler.stop();
74
+ ```
75
+
76
+ ## ScheduledTask
77
+
78
+ ```typescript
79
+ import { ScheduledTask } from '@twin.org/background-task-scheduler';
80
+
81
+ const scheduledTask = new ScheduledTask();
82
+ scheduledTask.id = 'nightly-index';
83
+ scheduledTask.lastRunTime = Date.now();
84
+
85
+ console.log(scheduledTask.id); // nightly-index
86
+ console.log(typeof scheduledTask.lastRunTime); // number
87
+ ```
88
+
89
+ ## initSchema
90
+
91
+ ```typescript
92
+ import { initSchema } from '@twin.org/background-task-scheduler';
93
+
94
+ initSchema();
95
+ ```
@@ -14,7 +14,7 @@ Class defining a scheduled task.
14
14
 
15
15
  ## Properties
16
16
 
17
- ### id
17
+ ### id {#id}
18
18
 
19
19
  > **id**: `string`
20
20
 
@@ -22,8 +22,8 @@ The id.
22
22
 
23
23
  ***
24
24
 
25
- ### lastRunTime?
25
+ ### lastRunTime? {#lastruntime}
26
26
 
27
- > `optional` **lastRunTime**: `number`
27
+ > `optional` **lastRunTime?**: `number`
28
28
 
29
29
  The last run time of the task, if undefined waiting for next run.
@@ -28,7 +28,7 @@ The options for the scheduler.
28
28
 
29
29
  ## Properties
30
30
 
31
- ### CLASS\_NAME
31
+ ### CLASS\_NAME {#class_name}
32
32
 
33
33
  > `readonly` `static` **CLASS\_NAME**: `string`
34
34
 
@@ -36,7 +36,7 @@ Runtime name for the class.
36
36
 
37
37
  ## Methods
38
38
 
39
- ### className()
39
+ ### className() {#classname}
40
40
 
41
41
  > **className**(): `string`
42
42
 
@@ -54,7 +54,7 @@ The class name of the component.
54
54
 
55
55
  ***
56
56
 
57
- ### stop()
57
+ ### stop() {#stop}
58
58
 
59
59
  > **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
60
60
 
@@ -80,7 +80,7 @@ Nothing.
80
80
 
81
81
  ***
82
82
 
83
- ### addTask()
83
+ ### addTask() {#addtask}
84
84
 
85
85
  > **addTask**(`taskId`, `times`, `taskCallback`): `Promise`\<`void`\>
86
86
 
@@ -118,7 +118,7 @@ Nothing.
118
118
 
119
119
  ***
120
120
 
121
- ### removeTask()
121
+ ### removeTask() {#removetask}
122
122
 
123
123
  > **removeTask**(`taskId`): `Promise`\<`void`\>
124
124
 
@@ -144,7 +144,7 @@ Nothing.
144
144
 
145
145
  ***
146
146
 
147
- ### tasksInfo()
147
+ ### tasksInfo() {#tasksinfo}
148
148
 
149
149
  > **tasksInfo**(): `Promise`\<`IScheduledTaskInfo`\>
150
150
 
@@ -4,9 +4,9 @@ Interface for the task scheduler configuration.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### intervalMs?
7
+ ### intervalMs? {#intervalms}
8
8
 
9
- > `optional` **intervalMs**: `number`
9
+ > `optional` **intervalMs?**: `number`
10
10
 
11
11
  The interval between checks for running tasks, defaults to 1 minute since that is the resolution of the tasks.
12
12
 
@@ -18,9 +18,9 @@ The interval between checks for running tasks, defaults to 1 minute since that i
18
18
 
19
19
  ***
20
20
 
21
- ### stalledTaskTimeoutMs?
21
+ ### stalledTaskTimeoutMs? {#stalledtasktimeoutms}
22
22
 
23
- > `optional` **stalledTaskTimeoutMs**: `number`
23
+ > `optional` **stalledTaskTimeoutMs?**: `number`
24
24
 
25
25
  The time in milliseconds after which a task that is still marked as running is considered stalled and can be run again.
26
26
 
@@ -4,9 +4,9 @@ Options for the task scheduler constructor.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### loggingComponentType?
7
+ ### loggingComponentType? {#loggingcomponenttype}
8
8
 
9
- > `optional` **loggingComponentType**: `string`
9
+ > `optional` **loggingComponentType?**: `string`
10
10
 
11
11
  The logging component type.
12
12
 
@@ -18,9 +18,9 @@ logging
18
18
 
19
19
  ***
20
20
 
21
- ### scheduledTaskEntityStorageType?
21
+ ### scheduledTaskEntityStorageType? {#scheduledtaskentitystoragetype}
22
22
 
23
- > `optional` **scheduledTaskEntityStorageType**: `string`
23
+ > `optional` **scheduledTaskEntityStorageType?**: `string`
24
24
 
25
25
  The scheduled task entity storage connector type.
26
26
 
@@ -32,8 +32,8 @@ scheduled-task
32
32
 
33
33
  ***
34
34
 
35
- ### config?
35
+ ### config? {#config}
36
36
 
37
- > `optional` **config**: [`ITaskSchedulerConfig`](ITaskSchedulerConfig.md)
37
+ > `optional` **config?**: [`ITaskSchedulerConfig`](ITaskSchedulerConfig.md)
38
38
 
39
39
  The configuration for the task scheduler.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/background-task-scheduler",
3
- "version": "0.0.3-next.4",
4
- "description": "Background task scheduler",
3
+ "version": "0.0.3-next.6",
4
+ "description": "Schedules background tasks for one-off or recurring execution windows",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/twinfoundation/background-task.git",
7
+ "url": "git+https://github.com/iotaledger/background-task.git",
8
8
  "directory": "packages/background-task-scheduler"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
@@ -14,7 +14,7 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/background-task-models": "0.0.3-next.4",
17
+ "@twin.org/background-task-models": "0.0.3-next.6",
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/entity-storage-models": "next",
20
20
  "@twin.org/logging-models": "next",
@@ -49,7 +49,7 @@
49
49
  "async"
50
50
  ],
51
51
  "bugs": {
52
- "url": "git+https://github.com/twinfoundation/background-task/issues"
52
+ "url": "git+https://github.com/iotaledger/background-task/issues"
53
53
  },
54
54
  "homepage": "https://twindev.org"
55
55
  }