@twin.org/background-task-models 0.0.1-next.8 → 0.0.1
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/dist/types/index.d.ts +3 -0
- package/dist/types/models/IBackgroundTask.d.ts +1 -1
- package/dist/types/models/IScheduledTaskInfo.d.ts +12 -0
- package/dist/types/models/IScheduledTaskTime.d.ts +21 -0
- package/dist/types/models/ITaskSchedulerComponent.d.ts +27 -0
- package/docs/changelog.md +74 -1
- package/docs/reference/index.md +3 -0
- package/docs/reference/interfaces/IBackgroundTask.md +7 -3
- package/docs/reference/interfaces/IBackgroundTaskConnector.md +80 -38
- package/docs/reference/interfaces/IScheduledTaskInfo.md +15 -0
- package/docs/reference/interfaces/IScheduledTaskTime.md +35 -0
- package/docs/reference/interfaces/ITaskSchedulerComponent.md +77 -0
- package/docs/reference/type-aliases/TaskStatus.md +1 -1
- package/package.json +6 -6
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * from "./factories/backgroundTaskConnectorFactory";
|
|
2
2
|
export * from "./models/IBackgroundTask";
|
|
3
3
|
export * from "./models/IBackgroundTaskConnector";
|
|
4
|
+
export * from "./models/IScheduledTaskInfo";
|
|
5
|
+
export * from "./models/IScheduledTaskTime";
|
|
6
|
+
export * from "./models/ITaskSchedulerComponent";
|
|
4
7
|
export * from "./models/taskStatus";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IScheduledTaskTime } from "./IScheduledTaskTime";
|
|
2
|
+
/**
|
|
3
|
+
* Interface describing a scheduled task information.
|
|
4
|
+
*/
|
|
5
|
+
export interface IScheduledTaskInfo {
|
|
6
|
+
/**
|
|
7
|
+
* The information for the tasks.
|
|
8
|
+
*/
|
|
9
|
+
tasks: {
|
|
10
|
+
[id: string]: IScheduledTaskTime[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface describing a scheduled task time.
|
|
3
|
+
*/
|
|
4
|
+
export interface IScheduledTaskTime {
|
|
5
|
+
/**
|
|
6
|
+
* The date/time to start the task, if not provided defaults to first interval from now.
|
|
7
|
+
*/
|
|
8
|
+
nextTriggerTime?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The interval in days to repeat the task, if no intervals are set the task will not repeat.
|
|
11
|
+
*/
|
|
12
|
+
intervalDays?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The interval in hours to repeat the task, if no intervals are set the task will not repeat.
|
|
15
|
+
*/
|
|
16
|
+
intervalHours?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The interval in minutes to repeat the task, if no intervals are set the task will not repeat.
|
|
19
|
+
*/
|
|
20
|
+
intervalMinutes?: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IComponent } from "@twin.org/core";
|
|
2
|
+
import type { IScheduledTaskInfo } from "./IScheduledTaskInfo";
|
|
3
|
+
import type { IScheduledTaskTime } from "./IScheduledTaskTime";
|
|
4
|
+
/**
|
|
5
|
+
* Interface describing a task scheduler.
|
|
6
|
+
*/
|
|
7
|
+
export interface ITaskSchedulerComponent extends IComponent {
|
|
8
|
+
/**
|
|
9
|
+
* Add a task to the scheduler.
|
|
10
|
+
* @param taskId The id of the task to add.
|
|
11
|
+
* @param times The times at which the task should be scheduled.
|
|
12
|
+
* @param taskCallback The callback to execute when the task is scheduled.
|
|
13
|
+
* @returns Nothing.
|
|
14
|
+
*/
|
|
15
|
+
addTask(taskId: string, times: IScheduledTaskTime[], taskCallback: () => Promise<void>): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Remove a task from the scheduler.
|
|
18
|
+
* @param taskId The id of the task to remove.
|
|
19
|
+
* @returns Nothing.
|
|
20
|
+
*/
|
|
21
|
+
removeTask(taskId: string): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the information about the tasks.
|
|
24
|
+
* @returns The tasks information.
|
|
25
|
+
*/
|
|
26
|
+
tasksInfo(): Promise<IScheduledTaskInfo>;
|
|
27
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# @twin.org/background-task-models - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.0.1 (2025-07-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* release to production ([7ce9896](https://github.com/twinfoundation/background-task/commit/7ce989659e6819f05655c86b1bda2a265af5d281))
|
|
9
|
+
|
|
10
|
+
## [0.0.1-next.21](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.20...background-task-models-v0.0.1-next.21) (2025-06-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* **background-task-models:** Synchronize repo versions
|
|
16
|
+
|
|
17
|
+
## [0.0.1-next.20](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.19...background-task-models-v0.0.1-next.20) (2025-06-23)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
23
|
+
* improve comment ([f2b4ac2](https://github.com/twinfoundation/background-task/commit/f2b4ac22fb8f735d2bf4ce28583cf7c54acdf272))
|
|
24
|
+
* update dependencies ([8e65767](https://github.com/twinfoundation/background-task/commit/8e657679f5e4305dbcb15ac7bcb3ab8a4613a60b))
|
|
25
|
+
* use shared store mechanism ([#6](https://github.com/twinfoundation/background-task/issues/6)) ([27ed203](https://github.com/twinfoundation/background-task/commit/27ed20367d5ace7257bfa7a82b59ad70e5b5d209))
|
|
26
|
+
|
|
27
|
+
## [0.0.1-next.19](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.18...background-task-models-v0.0.1-next.19) (2025-06-23)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* add task scheduler ([754d973](https://github.com/twinfoundation/background-task/commit/754d973e7c8483e5e54e887c157661867d5a0375))
|
|
33
|
+
|
|
34
|
+
## [0.0.1-next.18](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.17...background-task-models-v0.0.1-next.18) (2025-06-19)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Miscellaneous Chores
|
|
38
|
+
|
|
39
|
+
* **background-task-models:** Synchronize repo versions
|
|
40
|
+
|
|
41
|
+
## [0.0.1-next.17](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.16...background-task-models-v0.0.1-next.17) (2025-06-12)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* update dependencies ([8e65767](https://github.com/twinfoundation/background-task/commit/8e657679f5e4305dbcb15ac7bcb3ab8a4613a60b))
|
|
47
|
+
|
|
48
|
+
## [0.0.1-next.16](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.15...background-task-models-v0.0.1-next.16) (2025-06-05)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Miscellaneous Chores
|
|
52
|
+
|
|
53
|
+
* **background-task-models:** Synchronize repo versions
|
|
54
|
+
|
|
55
|
+
## [0.0.1-next.15](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.14...background-task-models-v0.0.1-next.15) (2025-04-17)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Features
|
|
59
|
+
|
|
60
|
+
* use shared store mechanism ([#6](https://github.com/twinfoundation/background-task/issues/6)) ([27ed203](https://github.com/twinfoundation/background-task/commit/27ed20367d5ace7257bfa7a82b59ad70e5b5d209))
|
|
61
|
+
|
|
62
|
+
## [0.0.1-next.14](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.13...background-task-models-v0.0.1-next.14) (2025-04-11)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Miscellaneous Chores
|
|
66
|
+
|
|
67
|
+
* **background-task-models:** Synchronize repo versions
|
|
68
|
+
|
|
69
|
+
## [0.0.1-next.13](https://github.com/twinfoundation/background-task/compare/background-task-models-v0.0.1-next.12...background-task-models-v0.0.1-next.13) (2025-03-28)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### Features
|
|
73
|
+
|
|
74
|
+
* improve comment ([f2b4ac2](https://github.com/twinfoundation/background-task/commit/f2b4ac22fb8f735d2bf4ce28583cf7c54acdf272))
|
|
75
|
+
|
|
76
|
+
## v0.0.1-next.12
|
|
4
77
|
|
|
5
78
|
- Initial Release
|
package/docs/reference/index.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
- [IBackgroundTask](interfaces/IBackgroundTask.md)
|
|
6
6
|
- [IBackgroundTaskConnector](interfaces/IBackgroundTaskConnector.md)
|
|
7
|
+
- [IScheduledTaskInfo](interfaces/IScheduledTaskInfo.md)
|
|
8
|
+
- [IScheduledTaskTime](interfaces/IScheduledTaskTime.md)
|
|
9
|
+
- [ITaskSchedulerComponent](interfaces/ITaskSchedulerComponent.md)
|
|
7
10
|
|
|
8
11
|
## Type Aliases
|
|
9
12
|
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
# Interface: IBackgroundTask\<T, U\>
|
|
2
2
|
|
|
3
|
-
Interface describing a background task
|
|
3
|
+
Interface describing a background task.
|
|
4
4
|
|
|
5
5
|
## Type Parameters
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### T
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
`T` = `any`
|
|
10
|
+
|
|
11
|
+
### U
|
|
12
|
+
|
|
13
|
+
`U` = `any`
|
|
10
14
|
|
|
11
15
|
## Properties
|
|
12
16
|
|
|
@@ -10,31 +10,43 @@ Interface describing a background task connector.
|
|
|
10
10
|
|
|
11
11
|
### registerHandler()
|
|
12
12
|
|
|
13
|
-
> **registerHandler**\<`T`, `U`\>(`taskType`, `module`, `method`, `stateChangeCallback
|
|
13
|
+
> **registerHandler**\<`T`, `U`\>(`taskType`, `module`, `method`, `stateChangeCallback?`): `Promise`\<`void`\>
|
|
14
14
|
|
|
15
15
|
Register a handler for a task.
|
|
16
16
|
|
|
17
17
|
#### Type Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### T
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
`T`
|
|
22
|
+
|
|
23
|
+
##### U
|
|
24
|
+
|
|
25
|
+
`U`
|
|
22
26
|
|
|
23
27
|
#### Parameters
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
##### taskType
|
|
30
|
+
|
|
31
|
+
`string`
|
|
26
32
|
|
|
27
33
|
The type of the task the handler can process.
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
##### module
|
|
36
|
+
|
|
37
|
+
`string`
|
|
30
38
|
|
|
31
39
|
The module the handler is in.
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
##### method
|
|
42
|
+
|
|
43
|
+
`string`
|
|
34
44
|
|
|
35
45
|
The method in the module to execute.
|
|
36
46
|
|
|
37
|
-
|
|
47
|
+
##### stateChangeCallback?
|
|
48
|
+
|
|
49
|
+
(`task`) => `Promise`\<`void`\>
|
|
38
50
|
|
|
39
51
|
The callback to execute when the task state is updated.
|
|
40
52
|
|
|
@@ -54,7 +66,9 @@ Unregister a handler for a task.
|
|
|
54
66
|
|
|
55
67
|
#### Parameters
|
|
56
68
|
|
|
57
|
-
|
|
69
|
+
##### taskType
|
|
70
|
+
|
|
71
|
+
`string`
|
|
58
72
|
|
|
59
73
|
The type of the task handler to remove.
|
|
60
74
|
|
|
@@ -68,37 +82,49 @@ Nothing.
|
|
|
68
82
|
|
|
69
83
|
### create()
|
|
70
84
|
|
|
71
|
-
> **create**\<`T`\>(`type`, `payload
|
|
85
|
+
> **create**\<`T`\>(`type`, `payload?`, `options?`): `Promise`\<`string`\>
|
|
72
86
|
|
|
73
87
|
Create a new task.
|
|
74
88
|
|
|
75
89
|
#### Type Parameters
|
|
76
90
|
|
|
77
|
-
|
|
91
|
+
##### T
|
|
92
|
+
|
|
93
|
+
`T`
|
|
78
94
|
|
|
79
95
|
#### Parameters
|
|
80
96
|
|
|
81
|
-
|
|
97
|
+
##### type
|
|
98
|
+
|
|
99
|
+
`string`
|
|
82
100
|
|
|
83
101
|
The type of the task.
|
|
84
102
|
|
|
85
|
-
|
|
103
|
+
##### payload?
|
|
104
|
+
|
|
105
|
+
`T`
|
|
86
106
|
|
|
87
107
|
The payload for the task.
|
|
88
108
|
|
|
89
|
-
|
|
109
|
+
##### options?
|
|
90
110
|
|
|
91
111
|
Additional options for the task.
|
|
92
112
|
|
|
93
|
-
|
|
113
|
+
###### retryCount?
|
|
114
|
+
|
|
115
|
+
`number`
|
|
94
116
|
|
|
95
117
|
The number of times to retry the task if it fails, leave undefined to retry forever.
|
|
96
118
|
|
|
97
|
-
|
|
119
|
+
###### retryInterval?
|
|
120
|
+
|
|
121
|
+
`number`
|
|
98
122
|
|
|
99
123
|
The interval in milliseconds to wait between retries, defaults to 5000, leave undefined for default scheduling.
|
|
100
124
|
|
|
101
|
-
|
|
125
|
+
###### retainFor?
|
|
126
|
+
|
|
127
|
+
`number`
|
|
102
128
|
|
|
103
129
|
The amount of time in milliseconds to retain the result until removal, defaults to 0 for immediate removal, set to -1 to keep forever.
|
|
104
130
|
|
|
@@ -118,13 +144,19 @@ Get the task details.
|
|
|
118
144
|
|
|
119
145
|
#### Type Parameters
|
|
120
146
|
|
|
121
|
-
|
|
147
|
+
##### T
|
|
148
|
+
|
|
149
|
+
`T`
|
|
122
150
|
|
|
123
|
-
|
|
151
|
+
##### U
|
|
152
|
+
|
|
153
|
+
`U`
|
|
124
154
|
|
|
125
155
|
#### Parameters
|
|
126
156
|
|
|
127
|
-
|
|
157
|
+
##### taskId
|
|
158
|
+
|
|
159
|
+
`string`
|
|
128
160
|
|
|
129
161
|
The id of the task to get the details for.
|
|
130
162
|
|
|
@@ -144,7 +176,9 @@ Retry a failed task immediately instead of waiting for it's next scheduled retry
|
|
|
144
176
|
|
|
145
177
|
#### Parameters
|
|
146
178
|
|
|
147
|
-
|
|
179
|
+
##### taskId
|
|
180
|
+
|
|
181
|
+
`string`
|
|
148
182
|
|
|
149
183
|
The id of the task to retry.
|
|
150
184
|
|
|
@@ -164,7 +198,9 @@ Remove a task ignoring any retain until date.
|
|
|
164
198
|
|
|
165
199
|
#### Parameters
|
|
166
200
|
|
|
167
|
-
|
|
201
|
+
##### taskId
|
|
202
|
+
|
|
203
|
+
`string`
|
|
168
204
|
|
|
169
205
|
The id of the task to remove.
|
|
170
206
|
|
|
@@ -184,7 +220,9 @@ Cancel a task, will only be actioned if the task is currently pending.
|
|
|
184
220
|
|
|
185
221
|
#### Parameters
|
|
186
222
|
|
|
187
|
-
|
|
223
|
+
##### taskId
|
|
224
|
+
|
|
225
|
+
`string`
|
|
188
226
|
|
|
189
227
|
The id of the task to cancel.
|
|
190
228
|
|
|
@@ -198,46 +236,50 @@ Nothing.
|
|
|
198
236
|
|
|
199
237
|
### query()
|
|
200
238
|
|
|
201
|
-
> **query**(`taskType
|
|
239
|
+
> **query**(`taskType?`, `taskStatus?`, `sortProperty?`, `sortDirection?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: [`IBackgroundTask`](IBackgroundTask.md)\<`any`, `any`\>[]; `cursor?`: `string`; \}\>
|
|
202
240
|
|
|
203
241
|
Get a list of tasks.
|
|
204
242
|
|
|
205
243
|
#### Parameters
|
|
206
244
|
|
|
207
|
-
|
|
245
|
+
##### taskType?
|
|
246
|
+
|
|
247
|
+
`string`
|
|
208
248
|
|
|
209
249
|
The type of the task to get.
|
|
210
250
|
|
|
211
|
-
|
|
251
|
+
##### taskStatus?
|
|
252
|
+
|
|
253
|
+
[`TaskStatus`](../type-aliases/TaskStatus.md)
|
|
212
254
|
|
|
213
255
|
The status of the task to get.
|
|
214
256
|
|
|
215
|
-
|
|
257
|
+
##### sortProperty?
|
|
216
258
|
|
|
217
259
|
The property to sort by, defaults to dateCreated.
|
|
218
260
|
|
|
219
|
-
|
|
261
|
+
`"dateCreated"` | `"dateModified"` | `"dateCompleted"` | `"status"`
|
|
262
|
+
|
|
263
|
+
##### sortDirection?
|
|
264
|
+
|
|
265
|
+
`SortDirection`
|
|
220
266
|
|
|
221
267
|
The order to sort by, defaults to ascending.
|
|
222
268
|
|
|
223
|
-
|
|
269
|
+
##### cursor?
|
|
270
|
+
|
|
271
|
+
`string`
|
|
224
272
|
|
|
225
273
|
The cursor to get the next page of tasks.
|
|
226
274
|
|
|
227
|
-
|
|
275
|
+
##### pageSize?
|
|
276
|
+
|
|
277
|
+
`number`
|
|
228
278
|
|
|
229
279
|
The maximum number of entities in a page.
|
|
230
280
|
|
|
231
281
|
#### Returns
|
|
232
282
|
|
|
233
|
-
`Promise
|
|
283
|
+
`Promise`\<\{ `entities`: [`IBackgroundTask`](IBackgroundTask.md)\<`any`, `any`\>[]; `cursor?`: `string`; \}\>
|
|
234
284
|
|
|
235
285
|
The list of tasks.
|
|
236
|
-
|
|
237
|
-
##### entities
|
|
238
|
-
|
|
239
|
-
> **entities**: [`IBackgroundTask`](IBackgroundTask.md)\<`any`, `any`\>[]
|
|
240
|
-
|
|
241
|
-
##### cursor?
|
|
242
|
-
|
|
243
|
-
> `optional` **cursor**: `string`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Interface: IScheduledTaskInfo
|
|
2
|
+
|
|
3
|
+
Interface describing a scheduled task information.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### tasks
|
|
8
|
+
|
|
9
|
+
> **tasks**: `object`
|
|
10
|
+
|
|
11
|
+
The information for the tasks.
|
|
12
|
+
|
|
13
|
+
#### Index Signature
|
|
14
|
+
|
|
15
|
+
\[`id`: `string`\]: [`IScheduledTaskTime`](IScheduledTaskTime.md)[]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Interface: IScheduledTaskTime
|
|
2
|
+
|
|
3
|
+
Interface describing a scheduled task time.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### nextTriggerTime?
|
|
8
|
+
|
|
9
|
+
> `optional` **nextTriggerTime**: `number`
|
|
10
|
+
|
|
11
|
+
The date/time to start the task, if not provided defaults to first interval from now.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### intervalDays?
|
|
16
|
+
|
|
17
|
+
> `optional` **intervalDays**: `number`
|
|
18
|
+
|
|
19
|
+
The interval in days to repeat the task, if no intervals are set the task will not repeat.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### intervalHours?
|
|
24
|
+
|
|
25
|
+
> `optional` **intervalHours**: `number`
|
|
26
|
+
|
|
27
|
+
The interval in hours to repeat the task, if no intervals are set the task will not repeat.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### intervalMinutes?
|
|
32
|
+
|
|
33
|
+
> `optional` **intervalMinutes**: `number`
|
|
34
|
+
|
|
35
|
+
The interval in minutes to repeat the task, if no intervals are set the task will not repeat.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Interface: ITaskSchedulerComponent
|
|
2
|
+
|
|
3
|
+
Interface describing a task scheduler.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### addTask()
|
|
12
|
+
|
|
13
|
+
> **addTask**(`taskId`, `times`, `taskCallback`): `Promise`\<`void`\>
|
|
14
|
+
|
|
15
|
+
Add a task to the scheduler.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### taskId
|
|
20
|
+
|
|
21
|
+
`string`
|
|
22
|
+
|
|
23
|
+
The id of the task to add.
|
|
24
|
+
|
|
25
|
+
##### times
|
|
26
|
+
|
|
27
|
+
[`IScheduledTaskTime`](IScheduledTaskTime.md)[]
|
|
28
|
+
|
|
29
|
+
The times at which the task should be scheduled.
|
|
30
|
+
|
|
31
|
+
##### taskCallback
|
|
32
|
+
|
|
33
|
+
() => `Promise`\<`void`\>
|
|
34
|
+
|
|
35
|
+
The callback to execute when the task is scheduled.
|
|
36
|
+
|
|
37
|
+
#### Returns
|
|
38
|
+
|
|
39
|
+
`Promise`\<`void`\>
|
|
40
|
+
|
|
41
|
+
Nothing.
|
|
42
|
+
|
|
43
|
+
***
|
|
44
|
+
|
|
45
|
+
### removeTask()
|
|
46
|
+
|
|
47
|
+
> **removeTask**(`taskId`): `Promise`\<`void`\>
|
|
48
|
+
|
|
49
|
+
Remove a task from the scheduler.
|
|
50
|
+
|
|
51
|
+
#### Parameters
|
|
52
|
+
|
|
53
|
+
##### taskId
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The id of the task to remove.
|
|
58
|
+
|
|
59
|
+
#### Returns
|
|
60
|
+
|
|
61
|
+
`Promise`\<`void`\>
|
|
62
|
+
|
|
63
|
+
Nothing.
|
|
64
|
+
|
|
65
|
+
***
|
|
66
|
+
|
|
67
|
+
### tasksInfo()
|
|
68
|
+
|
|
69
|
+
> **tasksInfo**(): `Promise`\<[`IScheduledTaskInfo`](IScheduledTaskInfo.md)\>
|
|
70
|
+
|
|
71
|
+
Get the information about the tasks.
|
|
72
|
+
|
|
73
|
+
#### Returns
|
|
74
|
+
|
|
75
|
+
`Promise`\<[`IScheduledTaskInfo`](IScheduledTaskInfo.md)\>
|
|
76
|
+
|
|
77
|
+
The tasks information.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: TaskStatus
|
|
2
2
|
|
|
3
|
-
> **TaskStatus
|
|
3
|
+
> **TaskStatus** = *typeof* [`TaskStatus`](../variables/TaskStatus.md)\[keyof *typeof* [`TaskStatus`](../variables/TaskStatus.md)\]
|
|
4
4
|
|
|
5
5
|
Task statuses.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/background-task-models",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Models which define the structure of the background task contracts and connectors",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "
|
|
18
|
-
"@twin.org/entity": "
|
|
19
|
-
"@twin.org/nameof": "
|
|
17
|
+
"@twin.org/core": "^0.0.1",
|
|
18
|
+
"@twin.org/entity": "^0.0.1",
|
|
19
|
+
"@twin.org/nameof": "^0.0.1"
|
|
20
20
|
},
|
|
21
21
|
"main": "./dist/cjs/index.cjs",
|
|
22
22
|
"module": "./dist/esm/index.mjs",
|
|
23
23
|
"types": "./dist/types/index.d.ts",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
+
"types": "./dist/types/index.d.ts",
|
|
26
27
|
"require": "./dist/cjs/index.cjs",
|
|
27
|
-
"import": "./dist/esm/index.mjs"
|
|
28
|
-
"types": "./dist/types/index.d.ts"
|
|
28
|
+
"import": "./dist/esm/index.mjs"
|
|
29
29
|
},
|
|
30
30
|
"./locales/*.json": "./locales/*.json"
|
|
31
31
|
},
|