@twin.org/background-task-scheduler 0.0.2-next.4 → 0.0.2-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/dist/cjs/index.cjs +4 -6
- package/dist/esm/index.mjs +5 -7
- package/dist/types/models/ITaskSchedulerConstructorOptions.d.ts +2 -2
- package/dist/types/taskSchedulerService.d.ts +2 -5
- package/docs/changelog.md +28 -0
- package/docs/reference/classes/TaskSchedulerService.md +3 -7
- package/docs/reference/interfaces/ITaskSchedulerConstructorOptions.md +3 -3
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@twin.org/core');
|
|
4
|
-
var loggingModels = require('@twin.org/logging-models');
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Class for scheduling tasks.
|
|
@@ -12,7 +11,7 @@ class TaskSchedulerService {
|
|
|
12
11
|
*/
|
|
13
12
|
CLASS_NAME = "TaskSchedulerService";
|
|
14
13
|
/**
|
|
15
|
-
* The logger for the task
|
|
14
|
+
* The logger for the task service.
|
|
16
15
|
* @internal
|
|
17
16
|
*/
|
|
18
17
|
_logging;
|
|
@@ -36,18 +35,17 @@ class TaskSchedulerService {
|
|
|
36
35
|
* @param options The options for the scheduler.
|
|
37
36
|
*/
|
|
38
37
|
constructor(options) {
|
|
39
|
-
this._logging =
|
|
38
|
+
this._logging = core.ComponentFactory.getIfExists(options?.loggingComponentType ?? "logging");
|
|
40
39
|
this._tasks = {};
|
|
41
40
|
this._tickInterval = options?.config?.overrideInterval ?? 60 * 1000; // Default to 1 minute
|
|
42
41
|
}
|
|
43
42
|
/**
|
|
44
43
|
* The component needs to be stopped when the node is closed.
|
|
45
44
|
* @param nodeIdentity The identity of the node stopping the component.
|
|
46
|
-
* @param
|
|
47
|
-
* @param componentState A persistent state which can be modified by the method.
|
|
45
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
48
46
|
* @returns Nothing.
|
|
49
47
|
*/
|
|
50
|
-
async stop(nodeIdentity,
|
|
48
|
+
async stop(nodeIdentity, nodeLoggingComponentType) {
|
|
51
49
|
this.stopTimer();
|
|
52
50
|
}
|
|
53
51
|
/**
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Is, BaseError } from '@twin.org/core';
|
|
2
|
-
import { LoggingConnectorFactory } from '@twin.org/logging-models';
|
|
1
|
+
import { ComponentFactory, Is, BaseError } from '@twin.org/core';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Class for scheduling tasks.
|
|
@@ -10,7 +9,7 @@ class TaskSchedulerService {
|
|
|
10
9
|
*/
|
|
11
10
|
CLASS_NAME = "TaskSchedulerService";
|
|
12
11
|
/**
|
|
13
|
-
* The logger for the task
|
|
12
|
+
* The logger for the task service.
|
|
14
13
|
* @internal
|
|
15
14
|
*/
|
|
16
15
|
_logging;
|
|
@@ -34,18 +33,17 @@ class TaskSchedulerService {
|
|
|
34
33
|
* @param options The options for the scheduler.
|
|
35
34
|
*/
|
|
36
35
|
constructor(options) {
|
|
37
|
-
this._logging =
|
|
36
|
+
this._logging = ComponentFactory.getIfExists(options?.loggingComponentType ?? "logging");
|
|
38
37
|
this._tasks = {};
|
|
39
38
|
this._tickInterval = options?.config?.overrideInterval ?? 60 * 1000; // Default to 1 minute
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
42
41
|
* The component needs to be stopped when the node is closed.
|
|
43
42
|
* @param nodeIdentity The identity of the node stopping the component.
|
|
44
|
-
* @param
|
|
45
|
-
* @param componentState A persistent state which can be modified by the method.
|
|
43
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
46
44
|
* @returns Nothing.
|
|
47
45
|
*/
|
|
48
|
-
async stop(nodeIdentity,
|
|
46
|
+
async stop(nodeIdentity, nodeLoggingComponentType) {
|
|
49
47
|
this.stopTimer();
|
|
50
48
|
}
|
|
51
49
|
/**
|
|
@@ -4,10 +4,10 @@ import type { ITaskSchedulerConfig } from "./ITaskSchedulerConfig";
|
|
|
4
4
|
*/
|
|
5
5
|
export interface ITaskSchedulerConstructorOptions {
|
|
6
6
|
/**
|
|
7
|
-
* The logging
|
|
7
|
+
* The logging component type.
|
|
8
8
|
* @default logging
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
loggingComponentType?: string;
|
|
11
11
|
/**
|
|
12
12
|
* The configuration for the task scheduler.
|
|
13
13
|
*/
|
|
@@ -16,13 +16,10 @@ export declare class TaskSchedulerService implements ITaskSchedulerComponent {
|
|
|
16
16
|
/**
|
|
17
17
|
* The component needs to be stopped when the node is closed.
|
|
18
18
|
* @param nodeIdentity The identity of the node stopping the component.
|
|
19
|
-
* @param
|
|
20
|
-
* @param componentState A persistent state which can be modified by the method.
|
|
19
|
+
* @param nodeLoggingComponentType The node logging component type.
|
|
21
20
|
* @returns Nothing.
|
|
22
21
|
*/
|
|
23
|
-
stop(nodeIdentity: string,
|
|
24
|
-
[id: string]: unknown;
|
|
25
|
-
}): Promise<void>;
|
|
22
|
+
stop(nodeIdentity: string, nodeLoggingComponentType: string | undefined): Promise<void>;
|
|
26
23
|
/**
|
|
27
24
|
* Add a task to the scheduler.
|
|
28
25
|
* @param taskId The id of the task to add.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [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)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* remove unused parameters ([1028b3c](https://github.com/twinfoundation/background-task/commit/1028b3cc147c25da22a8ba8d7207acfb34f89cdb))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/background-task-models bumped from 0.0.2-next.5 to 0.0.2-next.6
|
|
16
|
+
|
|
17
|
+
## [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* update framework core ([a068098](https://github.com/twinfoundation/background-task/commit/a0680983d7923a1bfb980a67879019bb870ccc5d))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/background-task-models bumped from 0.0.2-next.4 to 0.0.2-next.5
|
|
30
|
+
|
|
3
31
|
## [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)
|
|
4
32
|
|
|
5
33
|
|
|
@@ -42,7 +42,7 @@ Runtime name for the class.
|
|
|
42
42
|
|
|
43
43
|
### stop()
|
|
44
44
|
|
|
45
|
-
> **stop**(`nodeIdentity`, `
|
|
45
|
+
> **stop**(`nodeIdentity`, `nodeLoggingComponentType`): `Promise`\<`void`\>
|
|
46
46
|
|
|
47
47
|
The component needs to be stopped when the node is closed.
|
|
48
48
|
|
|
@@ -54,16 +54,12 @@ The component needs to be stopped when the node is closed.
|
|
|
54
54
|
|
|
55
55
|
The identity of the node stopping the component.
|
|
56
56
|
|
|
57
|
-
#####
|
|
57
|
+
##### nodeLoggingComponentType
|
|
58
58
|
|
|
59
|
-
The node logging
|
|
59
|
+
The node logging component type.
|
|
60
60
|
|
|
61
61
|
`undefined` | `string`
|
|
62
62
|
|
|
63
|
-
##### componentState?
|
|
64
|
-
|
|
65
|
-
A persistent state which can be modified by the method.
|
|
66
|
-
|
|
67
63
|
#### Returns
|
|
68
64
|
|
|
69
65
|
`Promise`\<`void`\>
|
|
@@ -4,11 +4,11 @@ Options for the task scheduler constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### loggingComponentType?
|
|
8
8
|
|
|
9
|
-
> `optional` **
|
|
9
|
+
> `optional` **loggingComponentType**: `string`
|
|
10
10
|
|
|
11
|
-
The logging
|
|
11
|
+
The logging component type.
|
|
12
12
|
|
|
13
13
|
#### Default
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/background-task-scheduler",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.6",
|
|
4
4
|
"description": "Background task scheduler",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/background-task-models": "0.0.2-next.
|
|
17
|
+
"@twin.org/background-task-models": "0.0.2-next.6",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
19
|
"@twin.org/logging-models": "next",
|
|
20
20
|
"@twin.org/nameof": "next"
|