@twin.org/background-task-scheduler 0.0.2-next.9 → 0.0.3-next.10
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 +1 -1
- package/dist/es/entities/scheduledTask.js +29 -0
- package/dist/es/entities/scheduledTask.js.map +1 -0
- package/dist/es/index.js +8 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/ITaskSchedulerConfig.js +4 -0
- package/dist/es/models/ITaskSchedulerConfig.js.map +1 -0
- package/dist/es/models/ITaskSchedulerConstructorOptions.js +2 -0
- package/dist/es/models/ITaskSchedulerConstructorOptions.js.map +1 -0
- package/dist/es/schema.js +11 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/{esm/index.mjs → es/taskSchedulerService.js} +100 -24
- package/dist/es/taskSchedulerService.js.map +1 -0
- package/dist/types/entities/scheduledTask.d.ts +13 -0
- package/dist/types/index.d.ts +5 -3
- package/dist/types/models/ITaskSchedulerConfig.d.ts +6 -1
- package/dist/types/models/ITaskSchedulerConstructorOptions.d.ts +6 -1
- package/dist/types/schema.d.ts +4 -0
- package/dist/types/taskSchedulerService.d.ts +7 -3
- package/docs/changelog.md +203 -31
- package/docs/examples.md +95 -1
- package/docs/reference/classes/ScheduledTask.md +29 -0
- package/docs/reference/classes/TaskSchedulerService.md +25 -13
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +5 -0
- package/docs/reference/interfaces/ITaskSchedulerConfig.md +16 -2
- package/docs/reference/interfaces/ITaskSchedulerConstructorOptions.md +18 -4
- package/locales/en.json +5 -0
- package/package.json +10 -11
- package/dist/cjs/index.cjs +0 -209
package/docs/changelog.md
CHANGED
|
@@ -1,11 +1,183 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.
|
|
3
|
+
## [0.0.3-next.10](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.9...background-task-scheduler-v0.0.3-next.10) (2026-06-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **background-task-scheduler:** Synchronize repo versions
|
|
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.9 to 0.0.3-next.10
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.9](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.8...background-task-scheduler-v0.0.3-next.9) (2026-06-08)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add context id features ([#29](https://github.com/iotaledger/twin-background-task/issues/29)) ([46ede49](https://github.com/iotaledger/twin-background-task/commit/46ede49a51a4955fe1530e645a66f0073db9a1fd))
|
|
23
|
+
* add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
24
|
+
* add validate-locales ([968cbf9](https://github.com/iotaledger/twin-background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
|
|
25
|
+
* background tasks immediately trigger ([a0a847b](https://github.com/iotaledger/twin-background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
|
|
26
|
+
* eslint migration to flat config ([6c9136c](https://github.com/iotaledger/twin-background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
|
|
27
|
+
* multi-instance lock ([#39](https://github.com/iotaledger/twin-background-task/issues/39)) ([7dcd434](https://github.com/iotaledger/twin-background-task/commit/7dcd434da5e3d1645b6fcd19ed34be4e628e50de))
|
|
28
|
+
* remove unused parameters ([1028b3c](https://github.com/iotaledger/twin-background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
|
|
29
|
+
* rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
|
|
30
|
+
* rename task scheduler component to service ([f097a98](https://github.com/iotaledger/twin-background-task/commit/f097a988c9ee0795aa55d74deda616365ec4ffb1))
|
|
31
|
+
* typescript 6 update ([e3f2727](https://github.com/iotaledger/twin-background-task/commit/e3f272783e0de7cf4d31f3e84a8e6f5ff633961b))
|
|
32
|
+
* update dependencies ([0867e02](https://github.com/iotaledger/twin-background-task/commit/0867e02fc3c034f8e8cf5918ac6cc4e6b5ca0c93))
|
|
33
|
+
* update framework core ([a068098](https://github.com/iotaledger/twin-background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
|
|
34
|
+
* update IComponent signatures ([e1a79bc](https://github.com/iotaledger/twin-background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
|
|
40
|
+
* restore task context in background task state-change callbacks ([#46](https://github.com/iotaledger/twin-background-task/issues/46)) ([d4f9f3b](https://github.com/iotaledger/twin-background-task/commit/d4f9f3bb57f8fb83c62024f9a385c81e2d511920))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Dependencies
|
|
44
|
+
|
|
45
|
+
* The following workspace dependencies were updated
|
|
46
|
+
* dependencies
|
|
47
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
48
|
+
|
|
49
|
+
## [0.0.3-next.8](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.7...background-task-scheduler-v0.0.3-next.8) (2026-06-08)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Bug Fixes
|
|
53
|
+
|
|
54
|
+
* restore task context in background task state-change callbacks ([#46](https://github.com/iotaledger/twin-background-task/issues/46)) ([d4f9f3b](https://github.com/iotaledger/twin-background-task/commit/d4f9f3bb57f8fb83c62024f9a385c81e2d511920))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Dependencies
|
|
58
|
+
|
|
59
|
+
* The following workspace dependencies were updated
|
|
60
|
+
* dependencies
|
|
61
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
62
|
+
|
|
63
|
+
## [0.0.3-next.7](https://github.com/iotaledger/twin-background-task/compare/background-task-scheduler-v0.0.3-next.6...background-task-scheduler-v0.0.3-next.7) (2026-05-20)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* update dependencies ([0867e02](https://github.com/iotaledger/twin-background-task/commit/0867e02fc3c034f8e8cf5918ac6cc4e6b5ca0c93))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Dependencies
|
|
72
|
+
|
|
73
|
+
* The following workspace dependencies were updated
|
|
74
|
+
* dependencies
|
|
75
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
76
|
+
|
|
77
|
+
## [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)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Features
|
|
81
|
+
|
|
82
|
+
* typescript 6 update ([e3f2727](https://github.com/iotaledger/twin-background-task/commit/e3f272783e0de7cf4d31f3e84a8e6f5ff633961b))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Dependencies
|
|
86
|
+
|
|
87
|
+
* The following workspace dependencies were updated
|
|
88
|
+
* dependencies
|
|
89
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
90
|
+
|
|
91
|
+
## [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)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Miscellaneous Chores
|
|
95
|
+
|
|
96
|
+
* **background-task-scheduler:** Synchronize repo versions
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Dependencies
|
|
100
|
+
|
|
101
|
+
* The following workspace dependencies were updated
|
|
102
|
+
* dependencies
|
|
103
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
104
|
+
|
|
105
|
+
## [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)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Features
|
|
109
|
+
|
|
110
|
+
* multi-instance lock ([#39](https://github.com/iotaledger/twin-background-task/issues/39)) ([7dcd434](https://github.com/iotaledger/twin-background-task/commit/7dcd434da5e3d1645b6fcd19ed34be4e628e50de))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Dependencies
|
|
114
|
+
|
|
115
|
+
* The following workspace dependencies were updated
|
|
116
|
+
* dependencies
|
|
117
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
118
|
+
|
|
119
|
+
## [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)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Miscellaneous Chores
|
|
123
|
+
|
|
124
|
+
* **background-task-scheduler:** Synchronize repo versions
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Dependencies
|
|
128
|
+
|
|
129
|
+
* The following workspace dependencies were updated
|
|
130
|
+
* dependencies
|
|
131
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
132
|
+
|
|
133
|
+
## [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)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### Miscellaneous Chores
|
|
137
|
+
|
|
138
|
+
* **background-task-scheduler:** Synchronize repo versions
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Dependencies
|
|
142
|
+
|
|
143
|
+
* The following workspace dependencies were updated
|
|
144
|
+
* dependencies
|
|
145
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
146
|
+
|
|
147
|
+
## [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)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### Features
|
|
151
|
+
|
|
152
|
+
* add context id features ([#29](https://github.com/iotaledger/twin-background-task/issues/29)) ([46ede49](https://github.com/iotaledger/twin-background-task/commit/46ede49a51a4955fe1530e645a66f0073db9a1fd))
|
|
153
|
+
* add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
154
|
+
* add validate-locales ([968cbf9](https://github.com/iotaledger/twin-background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
|
|
155
|
+
* background tasks immediately trigger ([a0a847b](https://github.com/iotaledger/twin-background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
|
|
156
|
+
* eslint migration to flat config ([6c9136c](https://github.com/iotaledger/twin-background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
|
|
157
|
+
* remove unused parameters ([1028b3c](https://github.com/iotaledger/twin-background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
|
|
158
|
+
* rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
|
|
159
|
+
* rename task scheduler component to service ([f097a98](https://github.com/iotaledger/twin-background-task/commit/f097a988c9ee0795aa55d74deda616365ec4ffb1))
|
|
160
|
+
* update framework core ([a068098](https://github.com/iotaledger/twin-background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
|
|
161
|
+
* update IComponent signatures ([e1a79bc](https://github.com/iotaledger/twin-background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
### Bug Fixes
|
|
165
|
+
|
|
166
|
+
* models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
### Dependencies
|
|
170
|
+
|
|
171
|
+
* The following workspace dependencies were updated
|
|
172
|
+
* dependencies
|
|
173
|
+
* @twin.org/background-task-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
174
|
+
|
|
175
|
+
## [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)
|
|
4
176
|
|
|
5
177
|
|
|
6
178
|
### Features
|
|
7
179
|
|
|
8
|
-
* add validate-locales ([968cbf9](https://github.com/
|
|
180
|
+
* add validate-locales ([968cbf9](https://github.com/iotaledger/twin-background-task/commit/968cbf966fffb5060305e8b221fecc0b6c8105b9))
|
|
9
181
|
|
|
10
182
|
|
|
11
183
|
### Dependencies
|
|
@@ -14,12 +186,12 @@
|
|
|
14
186
|
* dependencies
|
|
15
187
|
* @twin.org/background-task-models bumped from 0.0.2-next.8 to 0.0.2-next.9
|
|
16
188
|
|
|
17
|
-
## [0.0.2-next.8](https://github.com/
|
|
189
|
+
## [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)
|
|
18
190
|
|
|
19
191
|
|
|
20
192
|
### Features
|
|
21
193
|
|
|
22
|
-
* update IComponent signatures ([e1a79bc](https://github.com/
|
|
194
|
+
* update IComponent signatures ([e1a79bc](https://github.com/iotaledger/twin-background-task/commit/e1a79bc4dd813435c56e376f231a4b4ecd2276bf))
|
|
23
195
|
|
|
24
196
|
|
|
25
197
|
### Dependencies
|
|
@@ -28,12 +200,12 @@
|
|
|
28
200
|
* dependencies
|
|
29
201
|
* @twin.org/background-task-models bumped from 0.0.2-next.7 to 0.0.2-next.8
|
|
30
202
|
|
|
31
|
-
## [0.0.2-next.7](https://github.com/
|
|
203
|
+
## [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)
|
|
32
204
|
|
|
33
205
|
|
|
34
206
|
### Features
|
|
35
207
|
|
|
36
|
-
* eslint migration to flat config ([6c9136c](https://github.com/
|
|
208
|
+
* eslint migration to flat config ([6c9136c](https://github.com/iotaledger/twin-background-task/commit/6c9136c37bccdbbd109892d1503660aab7080d49))
|
|
37
209
|
|
|
38
210
|
|
|
39
211
|
### Dependencies
|
|
@@ -42,12 +214,12 @@
|
|
|
42
214
|
* dependencies
|
|
43
215
|
* @twin.org/background-task-models bumped from 0.0.2-next.6 to 0.0.2-next.7
|
|
44
216
|
|
|
45
|
-
## [0.0.2-next.6](https://github.com/
|
|
217
|
+
## [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)
|
|
46
218
|
|
|
47
219
|
|
|
48
220
|
### Features
|
|
49
221
|
|
|
50
|
-
* remove unused parameters ([1028b3c](https://github.com/
|
|
222
|
+
* remove unused parameters ([1028b3c](https://github.com/iotaledger/twin-background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
|
|
51
223
|
|
|
52
224
|
|
|
53
225
|
### Dependencies
|
|
@@ -56,12 +228,12 @@
|
|
|
56
228
|
* dependencies
|
|
57
229
|
* @twin.org/background-task-models bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
58
230
|
|
|
59
|
-
## [0.0.2-next.5](https://github.com/
|
|
231
|
+
## [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)
|
|
60
232
|
|
|
61
233
|
|
|
62
234
|
### Features
|
|
63
235
|
|
|
64
|
-
* update framework core ([a068098](https://github.com/
|
|
236
|
+
* update framework core ([a068098](https://github.com/iotaledger/twin-background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
|
|
65
237
|
|
|
66
238
|
|
|
67
239
|
### Dependencies
|
|
@@ -70,12 +242,12 @@
|
|
|
70
242
|
* dependencies
|
|
71
243
|
* @twin.org/background-task-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
72
244
|
|
|
73
|
-
## [0.0.2-next.4](https://github.com/
|
|
245
|
+
## [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)
|
|
74
246
|
|
|
75
247
|
|
|
76
248
|
### Features
|
|
77
249
|
|
|
78
|
-
* background tasks immediately trigger ([a0a847b](https://github.com/
|
|
250
|
+
* background tasks immediately trigger ([a0a847b](https://github.com/iotaledger/twin-background-task/commit/a0a847ba9686adcd0460e810540959f87dcaeab1))
|
|
79
251
|
|
|
80
252
|
|
|
81
253
|
### Dependencies
|
|
@@ -84,12 +256,12 @@
|
|
|
84
256
|
* dependencies
|
|
85
257
|
* @twin.org/background-task-models bumped from 0.0.2-next.3 to 0.0.2-next.4
|
|
86
258
|
|
|
87
|
-
## [0.0.2-next.3](https://github.com/
|
|
259
|
+
## [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)
|
|
88
260
|
|
|
89
261
|
|
|
90
262
|
### Features
|
|
91
263
|
|
|
92
|
-
* rename task scheduler component to service ([f097a98](https://github.com/
|
|
264
|
+
* rename task scheduler component to service ([f097a98](https://github.com/iotaledger/twin-background-task/commit/f097a988c9ee0795aa55d74deda616365ec4ffb1))
|
|
93
265
|
|
|
94
266
|
|
|
95
267
|
### Dependencies
|
|
@@ -98,18 +270,18 @@
|
|
|
98
270
|
* dependencies
|
|
99
271
|
* @twin.org/background-task-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
100
272
|
|
|
101
|
-
## [0.0.2-next.2](https://github.com/
|
|
273
|
+
## [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)
|
|
102
274
|
|
|
103
275
|
|
|
104
276
|
### Features
|
|
105
277
|
|
|
106
|
-
* add task scheduler ([754d973](https://github.com/
|
|
107
|
-
* rename task scheduler component ([2f8aa59](https://github.com/
|
|
278
|
+
* add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
279
|
+
* rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
|
|
108
280
|
|
|
109
281
|
|
|
110
282
|
### Bug Fixes
|
|
111
283
|
|
|
112
|
-
* models import ([c830b0d](https://github.com/
|
|
284
|
+
* models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
|
|
113
285
|
|
|
114
286
|
|
|
115
287
|
### Dependencies
|
|
@@ -118,18 +290,18 @@
|
|
|
118
290
|
* dependencies
|
|
119
291
|
* @twin.org/background-task-models bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
120
292
|
|
|
121
|
-
## [0.0.2-next.1](https://github.com/
|
|
293
|
+
## [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)
|
|
122
294
|
|
|
123
295
|
|
|
124
296
|
### Features
|
|
125
297
|
|
|
126
|
-
* add task scheduler ([754d973](https://github.com/
|
|
127
|
-
* rename task scheduler component ([2f8aa59](https://github.com/
|
|
298
|
+
* add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
299
|
+
* rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
|
|
128
300
|
|
|
129
301
|
|
|
130
302
|
### Bug Fixes
|
|
131
303
|
|
|
132
|
-
* models import ([c830b0d](https://github.com/
|
|
304
|
+
* models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
|
|
133
305
|
|
|
134
306
|
|
|
135
307
|
### Dependencies
|
|
@@ -143,7 +315,7 @@
|
|
|
143
315
|
|
|
144
316
|
### Features
|
|
145
317
|
|
|
146
|
-
* release to production ([7ce9896](https://github.com/
|
|
318
|
+
* release to production ([7ce9896](https://github.com/iotaledger/twin-background-task/commit/7ce989659e6819f05655c86b1bda2a265af5d281))
|
|
147
319
|
|
|
148
320
|
|
|
149
321
|
### Dependencies
|
|
@@ -152,12 +324,12 @@
|
|
|
152
324
|
* dependencies
|
|
153
325
|
* @twin.org/background-task-models bumped from ^0.0.0 to ^0.0.1
|
|
154
326
|
|
|
155
|
-
## [0.0.1-next.21](https://github.com/
|
|
327
|
+
## [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)
|
|
156
328
|
|
|
157
329
|
|
|
158
330
|
### Features
|
|
159
331
|
|
|
160
|
-
* rename task scheduler component ([2f8aa59](https://github.com/
|
|
332
|
+
* rename task scheduler component ([2f8aa59](https://github.com/iotaledger/twin-background-task/commit/2f8aa59c069055ff020a3c0c149601f20c656022))
|
|
161
333
|
|
|
162
334
|
|
|
163
335
|
### Dependencies
|
|
@@ -166,17 +338,17 @@
|
|
|
166
338
|
* dependencies
|
|
167
339
|
* @twin.org/background-task-models bumped from 0.0.1-next.20 to 0.0.1-next.21
|
|
168
340
|
|
|
169
|
-
## [0.0.1-next.20](https://github.com/
|
|
341
|
+
## [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)
|
|
170
342
|
|
|
171
343
|
|
|
172
344
|
### Features
|
|
173
345
|
|
|
174
|
-
* add task scheduler ([754d973](https://github.com/
|
|
346
|
+
* add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
175
347
|
|
|
176
348
|
|
|
177
349
|
### Bug Fixes
|
|
178
350
|
|
|
179
|
-
* models import ([c830b0d](https://github.com/
|
|
351
|
+
* models import ([c830b0d](https://github.com/iotaledger/twin-background-task/commit/c830b0da4deb06f8aeca6fec8988be4da877e73b))
|
|
180
352
|
|
|
181
353
|
|
|
182
354
|
### Dependencies
|
|
@@ -185,12 +357,12 @@
|
|
|
185
357
|
* dependencies
|
|
186
358
|
* @twin.org/background-task-models bumped from 0.0.1-next.19 to 0.0.1-next.20
|
|
187
359
|
|
|
188
|
-
## [0.0.1-next.19](https://github.com/
|
|
360
|
+
## [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)
|
|
189
361
|
|
|
190
362
|
|
|
191
363
|
### Features
|
|
192
364
|
|
|
193
|
-
* add task scheduler ([754d973](https://github.com/
|
|
365
|
+
* add task scheduler ([754d973](https://github.com/iotaledger/twin-background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
194
366
|
|
|
195
367
|
|
|
196
368
|
### Dependencies
|
|
@@ -199,4 +371,4 @@
|
|
|
199
371
|
* dependencies
|
|
200
372
|
* @twin.org/background-task-models bumped from 0.0.1-next.18 to 0.0.1-next.19
|
|
201
373
|
|
|
202
|
-
##
|
|
374
|
+
## Changelog
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,95 @@
|
|
|
1
|
-
#
|
|
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
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Class: ScheduledTask
|
|
2
|
+
|
|
3
|
+
Class defining a scheduled task.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new ScheduledTask**(): `ScheduledTask`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`ScheduledTask`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### id {#id}
|
|
18
|
+
|
|
19
|
+
> **id**: `string`
|
|
20
|
+
|
|
21
|
+
The id.
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### lastRunTime? {#lastruntime}
|
|
26
|
+
|
|
27
|
+
> `optional` **lastRunTime?**: `number`
|
|
28
|
+
|
|
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,26 +36,38 @@ Runtime name for the class.
|
|
|
36
36
|
|
|
37
37
|
## Methods
|
|
38
38
|
|
|
39
|
-
###
|
|
39
|
+
### className() {#classname}
|
|
40
40
|
|
|
41
|
-
> **
|
|
41
|
+
> **className**(): `string`
|
|
42
|
+
|
|
43
|
+
Returns the class name of the component.
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`string`
|
|
48
|
+
|
|
49
|
+
The class name of the component.
|
|
50
|
+
|
|
51
|
+
#### Implementation of
|
|
52
|
+
|
|
53
|
+
`ITaskSchedulerComponent.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### stop() {#stop}
|
|
58
|
+
|
|
59
|
+
> **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
|
|
42
60
|
|
|
43
61
|
The component needs to be stopped when the node is closed.
|
|
44
62
|
|
|
45
63
|
#### Parameters
|
|
46
64
|
|
|
47
|
-
#####
|
|
65
|
+
##### nodeLoggingComponentType?
|
|
48
66
|
|
|
49
67
|
`string`
|
|
50
68
|
|
|
51
|
-
The identity of the node stopping the component.
|
|
52
|
-
|
|
53
|
-
##### nodeLoggingComponentType
|
|
54
|
-
|
|
55
69
|
The node logging component type.
|
|
56
70
|
|
|
57
|
-
`undefined` | `string`
|
|
58
|
-
|
|
59
71
|
#### Returns
|
|
60
72
|
|
|
61
73
|
`Promise`\<`void`\>
|
|
@@ -68,7 +80,7 @@ Nothing.
|
|
|
68
80
|
|
|
69
81
|
***
|
|
70
82
|
|
|
71
|
-
### addTask()
|
|
83
|
+
### addTask() {#addtask}
|
|
72
84
|
|
|
73
85
|
> **addTask**(`taskId`, `times`, `taskCallback`): `Promise`\<`void`\>
|
|
74
86
|
|
|
@@ -106,7 +118,7 @@ Nothing.
|
|
|
106
118
|
|
|
107
119
|
***
|
|
108
120
|
|
|
109
|
-
### removeTask()
|
|
121
|
+
### removeTask() {#removetask}
|
|
110
122
|
|
|
111
123
|
> **removeTask**(`taskId`): `Promise`\<`void`\>
|
|
112
124
|
|
|
@@ -132,7 +144,7 @@ Nothing.
|
|
|
132
144
|
|
|
133
145
|
***
|
|
134
146
|
|
|
135
|
-
### tasksInfo()
|
|
147
|
+
### tasksInfo() {#tasksinfo}
|
|
136
148
|
|
|
137
149
|
> **tasksInfo**(): `Promise`\<`IScheduledTaskInfo`\>
|
|
138
150
|
|
package/docs/reference/index.md
CHANGED
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
5
|
+
- [ScheduledTask](classes/ScheduledTask.md)
|
|
5
6
|
- [TaskSchedulerService](classes/TaskSchedulerService.md)
|
|
6
7
|
|
|
7
8
|
## Interfaces
|
|
8
9
|
|
|
9
10
|
- [ITaskSchedulerConfig](interfaces/ITaskSchedulerConfig.md)
|
|
10
11
|
- [ITaskSchedulerConstructorOptions](interfaces/ITaskSchedulerConstructorOptions.md)
|
|
12
|
+
|
|
13
|
+
## Functions
|
|
14
|
+
|
|
15
|
+
- [initSchema](functions/initSchema.md)
|
|
@@ -4,9 +4,9 @@ Interface for the task scheduler configuration.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### intervalMs? {#intervalms}
|
|
8
8
|
|
|
9
|
-
> `optional` **
|
|
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
|
|
|
@@ -15,3 +15,17 @@ The interval between checks for running tasks, defaults to 1 minute since that i
|
|
|
15
15
|
```ts
|
|
16
16
|
60000
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### stalledTaskTimeoutMs? {#stalledtasktimeoutms}
|
|
22
|
+
|
|
23
|
+
> `optional` **stalledTaskTimeoutMs?**: `number`
|
|
24
|
+
|
|
25
|
+
The time in milliseconds after which a task that is still marked as running is considered stalled and can be run again.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
300000
|
|
31
|
+
```
|