@twin.org/background-task-models 0.0.1-next.8 → 0.0.1-next.9
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/docs/changelog.md
CHANGED
|
@@ -22,19 +22,27 @@ Register a handler for a task.
|
|
|
22
22
|
|
|
23
23
|
#### Parameters
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### taskType
|
|
26
|
+
|
|
27
|
+
`string`
|
|
26
28
|
|
|
27
29
|
The type of the task the handler can process.
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
##### module
|
|
32
|
+
|
|
33
|
+
`string`
|
|
30
34
|
|
|
31
35
|
The module the handler is in.
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
##### method
|
|
38
|
+
|
|
39
|
+
`string`
|
|
34
40
|
|
|
35
41
|
The method in the module to execute.
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
##### stateChangeCallback?
|
|
44
|
+
|
|
45
|
+
(`task`) => `Promise`\<`void`\>
|
|
38
46
|
|
|
39
47
|
The callback to execute when the task state is updated.
|
|
40
48
|
|
|
@@ -54,7 +62,9 @@ Unregister a handler for a task.
|
|
|
54
62
|
|
|
55
63
|
#### Parameters
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
##### taskType
|
|
66
|
+
|
|
67
|
+
`string`
|
|
58
68
|
|
|
59
69
|
The type of the task handler to remove.
|
|
60
70
|
|
|
@@ -78,27 +88,37 @@ Create a new task.
|
|
|
78
88
|
|
|
79
89
|
#### Parameters
|
|
80
90
|
|
|
81
|
-
|
|
91
|
+
##### type
|
|
92
|
+
|
|
93
|
+
`string`
|
|
82
94
|
|
|
83
95
|
The type of the task.
|
|
84
96
|
|
|
85
|
-
|
|
97
|
+
##### payload?
|
|
98
|
+
|
|
99
|
+
`T`
|
|
86
100
|
|
|
87
101
|
The payload for the task.
|
|
88
102
|
|
|
89
|
-
|
|
103
|
+
##### options?
|
|
90
104
|
|
|
91
105
|
Additional options for the task.
|
|
92
106
|
|
|
93
|
-
|
|
107
|
+
###### retryCount
|
|
108
|
+
|
|
109
|
+
`number`
|
|
94
110
|
|
|
95
111
|
The number of times to retry the task if it fails, leave undefined to retry forever.
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
###### retryInterval
|
|
114
|
+
|
|
115
|
+
`number`
|
|
98
116
|
|
|
99
117
|
The interval in milliseconds to wait between retries, defaults to 5000, leave undefined for default scheduling.
|
|
100
118
|
|
|
101
|
-
|
|
119
|
+
###### retainFor
|
|
120
|
+
|
|
121
|
+
`number`
|
|
102
122
|
|
|
103
123
|
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
124
|
|
|
@@ -124,7 +144,9 @@ Get the task details.
|
|
|
124
144
|
|
|
125
145
|
#### Parameters
|
|
126
146
|
|
|
127
|
-
|
|
147
|
+
##### taskId
|
|
148
|
+
|
|
149
|
+
`string`
|
|
128
150
|
|
|
129
151
|
The id of the task to get the details for.
|
|
130
152
|
|
|
@@ -144,7 +166,9 @@ Retry a failed task immediately instead of waiting for it's next scheduled retry
|
|
|
144
166
|
|
|
145
167
|
#### Parameters
|
|
146
168
|
|
|
147
|
-
|
|
169
|
+
##### taskId
|
|
170
|
+
|
|
171
|
+
`string`
|
|
148
172
|
|
|
149
173
|
The id of the task to retry.
|
|
150
174
|
|
|
@@ -164,7 +188,9 @@ Remove a task ignoring any retain until date.
|
|
|
164
188
|
|
|
165
189
|
#### Parameters
|
|
166
190
|
|
|
167
|
-
|
|
191
|
+
##### taskId
|
|
192
|
+
|
|
193
|
+
`string`
|
|
168
194
|
|
|
169
195
|
The id of the task to remove.
|
|
170
196
|
|
|
@@ -184,7 +210,9 @@ Cancel a task, will only be actioned if the task is currently pending.
|
|
|
184
210
|
|
|
185
211
|
#### Parameters
|
|
186
212
|
|
|
187
|
-
|
|
213
|
+
##### taskId
|
|
214
|
+
|
|
215
|
+
`string`
|
|
188
216
|
|
|
189
217
|
The id of the task to cancel.
|
|
190
218
|
|
|
@@ -198,46 +226,50 @@ Nothing.
|
|
|
198
226
|
|
|
199
227
|
### query()
|
|
200
228
|
|
|
201
|
-
> **query**(`taskType`?, `taskStatus`?, `sortProperty`?, `sortDirection`?, `cursor`?, `pageSize`?): `Promise
|
|
229
|
+
> **query**(`taskType`?, `taskStatus`?, `sortProperty`?, `sortDirection`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: [`IBackgroundTask`](IBackgroundTask.md)[]; `cursor`: `string`; \}\>
|
|
202
230
|
|
|
203
231
|
Get a list of tasks.
|
|
204
232
|
|
|
205
233
|
#### Parameters
|
|
206
234
|
|
|
207
|
-
|
|
235
|
+
##### taskType?
|
|
236
|
+
|
|
237
|
+
`string`
|
|
208
238
|
|
|
209
239
|
The type of the task to get.
|
|
210
240
|
|
|
211
|
-
|
|
241
|
+
##### taskStatus?
|
|
242
|
+
|
|
243
|
+
[`TaskStatus`](../type-aliases/TaskStatus.md)
|
|
212
244
|
|
|
213
245
|
The status of the task to get.
|
|
214
246
|
|
|
215
|
-
|
|
247
|
+
##### sortProperty?
|
|
216
248
|
|
|
217
249
|
The property to sort by, defaults to dateCreated.
|
|
218
250
|
|
|
219
|
-
|
|
251
|
+
`"status"` | `"dateCreated"` | `"dateModified"` | `"dateCompleted"`
|
|
252
|
+
|
|
253
|
+
##### sortDirection?
|
|
254
|
+
|
|
255
|
+
`SortDirection`
|
|
220
256
|
|
|
221
257
|
The order to sort by, defaults to ascending.
|
|
222
258
|
|
|
223
|
-
|
|
259
|
+
##### cursor?
|
|
260
|
+
|
|
261
|
+
`string`
|
|
224
262
|
|
|
225
263
|
The cursor to get the next page of tasks.
|
|
226
264
|
|
|
227
|
-
|
|
265
|
+
##### pageSize?
|
|
266
|
+
|
|
267
|
+
`number`
|
|
228
268
|
|
|
229
269
|
The maximum number of entities in a page.
|
|
230
270
|
|
|
231
271
|
#### Returns
|
|
232
272
|
|
|
233
|
-
`Promise
|
|
273
|
+
`Promise`\<\{ `entities`: [`IBackgroundTask`](IBackgroundTask.md)[]; `cursor`: `string`; \}\>
|
|
234
274
|
|
|
235
275
|
The list of tasks.
|
|
236
|
-
|
|
237
|
-
##### entities
|
|
238
|
-
|
|
239
|
-
> **entities**: [`IBackgroundTask`](IBackgroundTask.md)\<`any`, `any`\>[]
|
|
240
|
-
|
|
241
|
-
##### cursor?
|
|
242
|
-
|
|
243
|
-
> `optional` **cursor**: `string`
|
package/package.json
CHANGED