@wmfs/tymly-schedule-plugin 1.12.0 → 1.13.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/.version +1 -1
- package/CHANGELOG.md +70 -0
- package/lib/components/services/schedule/index.js +20 -6
- package/package.json +9 -9
- package/plugin.json +1 -1
- package/test/schedule-tests.js +53 -3
package/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION=1.
|
|
1
|
+
VERSION=1.13.1
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
+
## [1.13.1](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.13.0...v1.13.1) (2026-03-17)
|
|
2
|
+
|
|
3
|
+
### Bug Fix(es) :bug:
|
|
4
|
+
|
|
5
|
+
* [sc-32407] Investigate why EPM Notifications are not being received when raising a statutory notice in ridge ([8d68a91](https://github.com/wmfs/tymly-schedule-plugin/commit/8d68a91cc31a61ee98185de37d418e8c1ecb6588))
|
|
6
|
+
|
|
7
|
+
### Build system dependencies :hammer:
|
|
8
|
+
|
|
9
|
+
* **deps-dev:** update dependency @semantic-release/exec to v7.1.0 ([#154](https://github.com/wmfs/tymly-schedule-plugin/issues/154)) ([8cd09d0](https://github.com/wmfs/tymly-schedule-plugin/commit/8cd09d0255baf75df189e17423936b6cf91e42dd))
|
|
10
|
+
* **deps-dev:** update dependency @semantic-release/release-notes-generator to v14.1.0 ([#179](https://github.com/wmfs/tymly-schedule-plugin/issues/179)) ([1e4f92d](https://github.com/wmfs/tymly-schedule-plugin/commit/1e4f92df3a5db14828b8effb4f9efdec28a0d3fe))
|
|
11
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.313.0 ([#147](https://github.com/wmfs/tymly-schedule-plugin/issues/147)) ([09af57f](https://github.com/wmfs/tymly-schedule-plugin/commit/09af57f34e4d07753091256ca64ff9afd0a22e77))
|
|
12
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.315.0 ([#148](https://github.com/wmfs/tymly-schedule-plugin/issues/148)) ([58f776d](https://github.com/wmfs/tymly-schedule-plugin/commit/58f776d35796a8c1f51ec96cad96e116971ebfa0))
|
|
13
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.317.0 ([#149](https://github.com/wmfs/tymly-schedule-plugin/issues/149)) ([b318d92](https://github.com/wmfs/tymly-schedule-plugin/commit/b318d92c15db26009b38ea218a790c19a7b36074))
|
|
14
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.319.0 ([#150](https://github.com/wmfs/tymly-schedule-plugin/issues/150)) ([fa7efcf](https://github.com/wmfs/tymly-schedule-plugin/commit/fa7efcfc426bacc25710be60195bc6999b44b67c))
|
|
15
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.323.0 ([#151](https://github.com/wmfs/tymly-schedule-plugin/issues/151)) ([a457f21](https://github.com/wmfs/tymly-schedule-plugin/commit/a457f21ae2f5322a062d28f6b6ace74135ea6a92))
|
|
16
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.327.0 ([#152](https://github.com/wmfs/tymly-schedule-plugin/issues/152)) ([591b57c](https://github.com/wmfs/tymly-schedule-plugin/commit/591b57c22a132cfb7c6983a79e4f5cf009e0c254))
|
|
17
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.332.0 ([#155](https://github.com/wmfs/tymly-schedule-plugin/issues/155)) ([6be937a](https://github.com/wmfs/tymly-schedule-plugin/commit/6be937a3e7f74c673eab512a73b0e2b65fcd0628))
|
|
18
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.333.0 ([#162](https://github.com/wmfs/tymly-schedule-plugin/issues/162)) ([d691f37](https://github.com/wmfs/tymly-schedule-plugin/commit/d691f374a857599ccdbe51cd5af21f873f216c83))
|
|
19
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.334.0 ([#163](https://github.com/wmfs/tymly-schedule-plugin/issues/163)) ([705a365](https://github.com/wmfs/tymly-schedule-plugin/commit/705a365d46ac4b2cdf36616490325633fadff713))
|
|
20
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.335.0 ([#165](https://github.com/wmfs/tymly-schedule-plugin/issues/165)) ([b395f76](https://github.com/wmfs/tymly-schedule-plugin/commit/b395f76ac3861697c4791f3693e668eaa516dca0))
|
|
21
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.337.0 ([#167](https://github.com/wmfs/tymly-schedule-plugin/issues/167)) ([d657fec](https://github.com/wmfs/tymly-schedule-plugin/commit/d657fecee8b55702f21861a7643f20f33fc79cde))
|
|
22
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.338.0 ([#170](https://github.com/wmfs/tymly-schedule-plugin/issues/170)) ([5eee342](https://github.com/wmfs/tymly-schedule-plugin/commit/5eee342fea042fb93b48cedc86df6f9aa9b3fa62))
|
|
23
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.339.0 ([#171](https://github.com/wmfs/tymly-schedule-plugin/issues/171)) ([5a2737f](https://github.com/wmfs/tymly-schedule-plugin/commit/5a2737f79e8477771ee9de81252d17a57b33de7a))
|
|
24
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.340.0 ([#172](https://github.com/wmfs/tymly-schedule-plugin/issues/172)) ([d43ceb2](https://github.com/wmfs/tymly-schedule-plugin/commit/d43ceb2848f1ac80ae9def8612fc67cba97628a5))
|
|
25
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.341.0 ([#174](https://github.com/wmfs/tymly-schedule-plugin/issues/174)) ([2e39a80](https://github.com/wmfs/tymly-schedule-plugin/commit/2e39a8005fce21d23f545c39be6a5316e8b47661))
|
|
26
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.346.0 ([#189](https://github.com/wmfs/tymly-schedule-plugin/issues/189)) ([81bb753](https://github.com/wmfs/tymly-schedule-plugin/commit/81bb75349d881d82e4f28cb4b24358deceaeee8d))
|
|
27
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.348.0 ([#190](https://github.com/wmfs/tymly-schedule-plugin/issues/190)) ([c595d4a](https://github.com/wmfs/tymly-schedule-plugin/commit/c595d4ac6d908d0f782024468f6c63c618517b1e))
|
|
28
|
+
* **deps-dev:** update dependency conventional-changelog-conventionalcommits to v9 ([#159](https://github.com/wmfs/tymly-schedule-plugin/issues/159)) ([0fe5244](https://github.com/wmfs/tymly-schedule-plugin/commit/0fe52440e6afd12c6eded392bee057fb8d173f8e))
|
|
29
|
+
* **deps-dev:** update dependency conventional-changelog-conventionalcommits to v9.1.0 ([#173](https://github.com/wmfs/tymly-schedule-plugin/issues/173)) ([4be4be3](https://github.com/wmfs/tymly-schedule-plugin/commit/4be4be3425a7674cf0f921b812b4a1b9e20d20b9))
|
|
30
|
+
* **deps-dev:** update dependency conventional-changelog-conventionalcommits to v9.2.0 ([#195](https://github.com/wmfs/tymly-schedule-plugin/issues/195)) ([aa671ee](https://github.com/wmfs/tymly-schedule-plugin/commit/aa671ee65cd3afec56174bead43c4e46c726894b))
|
|
31
|
+
* **deps-dev:** update dependency conventional-changelog-conventionalcommits to v9.3.0 ([#196](https://github.com/wmfs/tymly-schedule-plugin/issues/196)) ([02381ee](https://github.com/wmfs/tymly-schedule-plugin/commit/02381eeae36e74f888432bf7f6de60b2b2c93f57))
|
|
32
|
+
* **deps-dev:** update dependency mocha to v11.2.2 ([#153](https://github.com/wmfs/tymly-schedule-plugin/issues/153)) ([996ad74](https://github.com/wmfs/tymly-schedule-plugin/commit/996ad74bf7e8a02c5e38dc4b9288be80fe8638c9))
|
|
33
|
+
* **deps-dev:** update dependency mocha to v11.3.0 ([#156](https://github.com/wmfs/tymly-schedule-plugin/issues/156)) ([f2e4d01](https://github.com/wmfs/tymly-schedule-plugin/commit/f2e4d01e1ce1b0861c9e49e1ace225fa7425bed8))
|
|
34
|
+
* **deps-dev:** update dependency mocha to v11.4.0 ([#158](https://github.com/wmfs/tymly-schedule-plugin/issues/158)) ([7424a2f](https://github.com/wmfs/tymly-schedule-plugin/commit/7424a2fc45aac5b19875b3ebb5193ff36326d47d))
|
|
35
|
+
* **deps-dev:** update dependency mocha to v11.5.0 ([#161](https://github.com/wmfs/tymly-schedule-plugin/issues/161)) ([16158be](https://github.com/wmfs/tymly-schedule-plugin/commit/16158bee0c9cc8e782250e3d921185ee877e24cd))
|
|
36
|
+
* **deps-dev:** update dependency mocha to v11.6.0 ([#164](https://github.com/wmfs/tymly-schedule-plugin/issues/164)) ([7a5ce1c](https://github.com/wmfs/tymly-schedule-plugin/commit/7a5ce1c59a70b4da726fc092c4957ba7b771034b))
|
|
37
|
+
* **deps-dev:** update dependency mocha to v11.7.0 ([#166](https://github.com/wmfs/tymly-schedule-plugin/issues/166)) ([0617ab0](https://github.com/wmfs/tymly-schedule-plugin/commit/0617ab0dafff31cefee164405d3dccc5b5adf760))
|
|
38
|
+
* **deps-dev:** update dependency mocha to v11.7.1 ([#168](https://github.com/wmfs/tymly-schedule-plugin/issues/168)) ([9f7a7c0](https://github.com/wmfs/tymly-schedule-plugin/commit/9f7a7c0453788e03a2ebfc99de960488d3ddb4fb))
|
|
39
|
+
* **deps-dev:** update dependency mocha to v11.7.2 ([#177](https://github.com/wmfs/tymly-schedule-plugin/issues/177)) ([fe8c84e](https://github.com/wmfs/tymly-schedule-plugin/commit/fe8c84ea4a6fd089951713e6f3bd3c1c5803ba43))
|
|
40
|
+
* **deps-dev:** update dependency mocha to v11.7.3 ([#183](https://github.com/wmfs/tymly-schedule-plugin/issues/183)) ([ac21e65](https://github.com/wmfs/tymly-schedule-plugin/commit/ac21e65d76765ae70d70e1799bbe7ab59f5fcf34))
|
|
41
|
+
* **deps-dev:** update dependency mocha to v11.7.4 ([#184](https://github.com/wmfs/tymly-schedule-plugin/issues/184)) ([30c25f0](https://github.com/wmfs/tymly-schedule-plugin/commit/30c25f07da16a04deba8fd13812959acb951305f))
|
|
42
|
+
* **deps-dev:** update dependency mocha to v11.7.5 ([#187](https://github.com/wmfs/tymly-schedule-plugin/issues/187)) ([2ca8154](https://github.com/wmfs/tymly-schedule-plugin/commit/2ca815449ce94f7ca92dab843a5632419d9054f8))
|
|
43
|
+
* **deps-dev:** update dependency nyc to v18 ([#194](https://github.com/wmfs/tymly-schedule-plugin/issues/194)) ([3fd7ef7](https://github.com/wmfs/tymly-schedule-plugin/commit/3fd7ef7e10558e34ff20f235fc05eb0673d0ad55))
|
|
44
|
+
* **deps-dev:** update dependency semantic-release to v24.2.4 ([#157](https://github.com/wmfs/tymly-schedule-plugin/issues/157)) ([ef7f707](https://github.com/wmfs/tymly-schedule-plugin/commit/ef7f707efebf178b7cfdb615c1d2d7a381bc78b7))
|
|
45
|
+
* **deps-dev:** update dependency semantic-release to v24.2.5 ([#160](https://github.com/wmfs/tymly-schedule-plugin/issues/160)) ([ba72f2f](https://github.com/wmfs/tymly-schedule-plugin/commit/ba72f2ff59ab132f3b537f28035a44c38e27a950))
|
|
46
|
+
* **deps-dev:** update dependency semantic-release to v24.2.6 ([#169](https://github.com/wmfs/tymly-schedule-plugin/issues/169)) ([4a2be7e](https://github.com/wmfs/tymly-schedule-plugin/commit/4a2be7eb75a5d30caf25f65f8e135a187de27173))
|
|
47
|
+
* **deps-dev:** update dependency semantic-release to v24.2.7 ([#175](https://github.com/wmfs/tymly-schedule-plugin/issues/175)) ([5665eb0](https://github.com/wmfs/tymly-schedule-plugin/commit/5665eb0b9352588812ff9413e54e1cecdc358d13))
|
|
48
|
+
* **deps-dev:** update dependency semantic-release to v24.2.8 ([#181](https://github.com/wmfs/tymly-schedule-plugin/issues/181)) ([47843f1](https://github.com/wmfs/tymly-schedule-plugin/commit/47843f128c54d9c3945b615a025471986de3260c))
|
|
49
|
+
* **deps-dev:** update dependency semantic-release to v24.2.9 ([#182](https://github.com/wmfs/tymly-schedule-plugin/issues/182)) ([9112a32](https://github.com/wmfs/tymly-schedule-plugin/commit/9112a32737928906267775d6cc193fa8e7cbd014))
|
|
50
|
+
* **deps-dev:** update dependency semantic-release to v25 ([#185](https://github.com/wmfs/tymly-schedule-plugin/issues/185)) ([c962b5e](https://github.com/wmfs/tymly-schedule-plugin/commit/c962b5efb5549522eb2da1df57650fa0f7739487))
|
|
51
|
+
* **deps-dev:** update dependency semantic-release to v25.0.1 ([#186](https://github.com/wmfs/tymly-schedule-plugin/issues/186)) ([421f697](https://github.com/wmfs/tymly-schedule-plugin/commit/421f69738f87e6cc5d013d91f804d21ca6bfa68c))
|
|
52
|
+
* **deps-dev:** update dependency semantic-release to v25.0.2 ([#188](https://github.com/wmfs/tymly-schedule-plugin/issues/188)) ([547f483](https://github.com/wmfs/tymly-schedule-plugin/commit/547f4833d3c90d2acd848a555c85df2b314b1b77))
|
|
53
|
+
* **deps-dev:** update dependency semantic-release to v25.0.3 ([#192](https://github.com/wmfs/tymly-schedule-plugin/issues/192)) ([e32d34d](https://github.com/wmfs/tymly-schedule-plugin/commit/e32d34dfd5ffe83d4307ff38453db46d8d9ad489))
|
|
54
|
+
|
|
55
|
+
## [1.13.0](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.12.0...v1.13.0) (2025-02-20)
|
|
56
|
+
|
|
57
|
+
### Build system dependencies :hammer:
|
|
58
|
+
|
|
59
|
+
* **deps-dev:** update dependency @semantic-release/exec to v7 ([#138](https://github.com/wmfs/tymly-schedule-plugin/issues/138)) ([dfa212c](https://github.com/wmfs/tymly-schedule-plugin/commit/dfa212c4f0e095e62371ad6533cbf52f7b0bd645))
|
|
60
|
+
* **deps-dev:** update dependency @semantic-release/exec to v7.0.2 ([#139](https://github.com/wmfs/tymly-schedule-plugin/issues/139)) ([33bb401](https://github.com/wmfs/tymly-schedule-plugin/commit/33bb401557234fdb083ef107902d11c709d80baf))
|
|
61
|
+
* **deps-dev:** update dependency @semantic-release/exec to v7.0.3 ([#140](https://github.com/wmfs/tymly-schedule-plugin/issues/140)) ([f16bb9f](https://github.com/wmfs/tymly-schedule-plugin/commit/f16bb9f693968c2b574d0cb2f99289697cb8bf55))
|
|
62
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.306.0 ([#136](https://github.com/wmfs/tymly-schedule-plugin/issues/136)) ([b0f1b5d](https://github.com/wmfs/tymly-schedule-plugin/commit/b0f1b5dc5649314bb8fb5c4cef3379b0d72b90f3))
|
|
63
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.308.0 ([#142](https://github.com/wmfs/tymly-schedule-plugin/issues/142)) ([ae71d06](https://github.com/wmfs/tymly-schedule-plugin/commit/ae71d06db2975e1210da35b45be634358baa63a3))
|
|
64
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.309.0 ([#143](https://github.com/wmfs/tymly-schedule-plugin/issues/143)) ([8bc9366](https://github.com/wmfs/tymly-schedule-plugin/commit/8bc9366890a76694fe5138393d33c3b149cc8e3b))
|
|
65
|
+
* **deps-dev:** update dependency @wmfs/tymly-pg-plugin to v1.310.0 ([#145](https://github.com/wmfs/tymly-schedule-plugin/issues/145)) ([c7ddf8b](https://github.com/wmfs/tymly-schedule-plugin/commit/c7ddf8b09378d68b1e292deaaf143c8ca766cfa7))
|
|
66
|
+
* **deps-dev:** update dependency mocha to v11.1.0 ([#137](https://github.com/wmfs/tymly-schedule-plugin/issues/137)) ([6136778](https://github.com/wmfs/tymly-schedule-plugin/commit/6136778f8bc220e885434a6b0a257cd7321e1eee))
|
|
67
|
+
* **deps-dev:** update dependency semantic-release to v24.2.2 ([#141](https://github.com/wmfs/tymly-schedule-plugin/issues/141)) ([52bcc6d](https://github.com/wmfs/tymly-schedule-plugin/commit/52bcc6df1448e05f34af672c4cd451ba93de4bac))
|
|
68
|
+
* **deps-dev:** update dependency semantic-release to v24.2.3 ([#144](https://github.com/wmfs/tymly-schedule-plugin/issues/144)) ([82756ba](https://github.com/wmfs/tymly-schedule-plugin/commit/82756ba214d05bf16067bada0af362892aec047e))
|
|
69
|
+
* **deps:** update dependency uuid to v11.1.0 ([#146](https://github.com/wmfs/tymly-schedule-plugin/issues/146)) ([8f5998a](https://github.com/wmfs/tymly-schedule-plugin/commit/8f5998ad03c93e916c9fe27f46e3d7259ce29ec4))
|
|
70
|
+
|
|
1
71
|
## [1.12.0](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.11.0...v1.12.0) (2025-01-10)
|
|
2
72
|
|
|
3
73
|
### Build system dependencies :hammer:
|
|
@@ -8,6 +8,7 @@ const { v4: uuidv4 } = require('uuid')
|
|
|
8
8
|
class CronService {
|
|
9
9
|
async boot (options) {
|
|
10
10
|
this.statebox = options.bootedServices.statebox
|
|
11
|
+
this.userInfo = options.bootedServices.userInfo
|
|
11
12
|
this.taskModel = options.bootedServices.storage.models.schedule_task
|
|
12
13
|
this.executionModel = options.bootedServices.storage.models.tymly_execution
|
|
13
14
|
|
|
@@ -21,7 +22,7 @@ class CronService {
|
|
|
21
22
|
}
|
|
22
23
|
} // boot
|
|
23
24
|
|
|
24
|
-
startTask (key) {
|
|
25
|
+
async startTask (key) {
|
|
25
26
|
const task = this.scheduledTasks[key]
|
|
26
27
|
|
|
27
28
|
if (!task) {
|
|
@@ -35,7 +36,9 @@ class CronService {
|
|
|
35
36
|
datetime,
|
|
36
37
|
stateMachineName,
|
|
37
38
|
sendResponse,
|
|
38
|
-
input
|
|
39
|
+
input,
|
|
40
|
+
createdBy,
|
|
41
|
+
modifiedBy
|
|
39
42
|
} = task
|
|
40
43
|
|
|
41
44
|
const jobOptions = {
|
|
@@ -54,6 +57,9 @@ class CronService {
|
|
|
54
57
|
})
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
const email = modifiedBy ?? createdBy
|
|
61
|
+
const userId = email ? await this.userInfo.userIdFromEmail(email) : null
|
|
62
|
+
|
|
57
63
|
// todo: allow window for start/end datetimes
|
|
58
64
|
task.job = nodeSchedule.scheduleJob(
|
|
59
65
|
jobOptions,
|
|
@@ -67,6 +73,9 @@ class CronService {
|
|
|
67
73
|
},
|
|
68
74
|
sendResponse
|
|
69
75
|
}
|
|
76
|
+
if (userId) {
|
|
77
|
+
executionOptions.userId = userId
|
|
78
|
+
}
|
|
70
79
|
const cb = async (err, executionDescription) => {
|
|
71
80
|
if (err) {
|
|
72
81
|
console.log(`There was an error on execution of scheduled state machine ${stateMachineName}`)
|
|
@@ -162,7 +171,7 @@ class CronService {
|
|
|
162
171
|
} // findTasks
|
|
163
172
|
|
|
164
173
|
persistTask (key, config) {
|
|
165
|
-
|
|
174
|
+
const task = {
|
|
166
175
|
key,
|
|
167
176
|
stateMachineName: config.stateMachineName,
|
|
168
177
|
input: config.input,
|
|
@@ -172,7 +181,13 @@ class CronService {
|
|
|
172
181
|
datetime: config.datetime,
|
|
173
182
|
startOnBoot: config.startOnBoot,
|
|
174
183
|
status: null
|
|
175
|
-
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (config.createdBy) {
|
|
187
|
+
task.createdBy = config.createdBy
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return this.taskModel.create(task)
|
|
176
191
|
} // persistTask
|
|
177
192
|
|
|
178
193
|
checkIfStateMachineExists (stateMachineName) {
|
|
@@ -265,7 +280,6 @@ class CronService {
|
|
|
265
280
|
|
|
266
281
|
createScheduledTask (key, config = {}) {
|
|
267
282
|
if (key === null) {
|
|
268
|
-
console.log('no key, generating...')
|
|
269
283
|
key = uuidv4()
|
|
270
284
|
}
|
|
271
285
|
this.scheduledTasks[key] = config
|
|
@@ -279,5 +293,5 @@ class CronService {
|
|
|
279
293
|
|
|
280
294
|
module.exports = {
|
|
281
295
|
serviceClass: CronService,
|
|
282
|
-
bootAfter: ['statebox']
|
|
296
|
+
bootAfter: ['statebox', 'userInfo']
|
|
283
297
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wmfs/tymly-schedule-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "Provides state machine scheduling for the Tymly framework",
|
|
5
5
|
"homepage": "https://github.com/wmfs/tymly-schedule-plugin#readme",
|
|
6
6
|
"author": "West Midlands Fire Service",
|
|
@@ -23,25 +23,25 @@
|
|
|
23
23
|
"main": "./lib/index.js",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"node-schedule": "2.1.1",
|
|
26
|
-
"uuid": "11.0
|
|
26
|
+
"uuid": "11.1.0",
|
|
27
27
|
"moment": "2.30.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@semantic-release/changelog": "6.0.3",
|
|
31
|
-
"@semantic-release/release-notes-generator": "14.0
|
|
32
|
-
"@semantic-release/exec": "
|
|
31
|
+
"@semantic-release/release-notes-generator": "14.1.0",
|
|
32
|
+
"@semantic-release/exec": "7.1.0",
|
|
33
33
|
"@semantic-release/git": "10.0.1",
|
|
34
34
|
"@wmfs/tymly": "1.242.0",
|
|
35
|
-
"@wmfs/tymly-pg-plugin": "1.
|
|
35
|
+
"@wmfs/tymly-pg-plugin": "1.348.0",
|
|
36
36
|
"@wmfs/tymly-test-helpers": "1.24.0",
|
|
37
37
|
"chai": "4.5.0",
|
|
38
38
|
"codecov": "3.8.3",
|
|
39
|
-
"conventional-changelog-conventionalcommits": "
|
|
39
|
+
"conventional-changelog-conventionalcommits": "9.3.0",
|
|
40
40
|
"cz-conventional-changelog": "3.3.0",
|
|
41
41
|
"dirty-chai": "2.0.1",
|
|
42
|
-
"mocha": "11.
|
|
43
|
-
"nyc": "
|
|
44
|
-
"semantic-release": "
|
|
42
|
+
"mocha": "11.7.5",
|
|
43
|
+
"nyc": "18.0.0",
|
|
44
|
+
"semantic-release": "25.0.3",
|
|
45
45
|
"standard": "17.1.2"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
package/plugin.json
CHANGED
package/test/schedule-tests.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const expect = require('chai').expect
|
|
4
4
|
const tymly = require('@wmfs/tymly')
|
|
5
|
-
const path = require('path')
|
|
5
|
+
const path = require('node:path')
|
|
6
6
|
const moment = require('moment')
|
|
7
7
|
|
|
8
8
|
const scheduleKey = 'tymlyTest_twoSecondCatUpdates'
|
|
@@ -34,7 +34,8 @@ describe('Tymly schedule tests', function () {
|
|
|
34
34
|
pluginPaths: [
|
|
35
35
|
path.resolve(__dirname, '..'),
|
|
36
36
|
require.resolve('@wmfs/tymly-pg-plugin'),
|
|
37
|
-
require.resolve('@wmfs/tymly-test-helpers/plugins/mock-users-plugin')
|
|
37
|
+
require.resolve('@wmfs/tymly-test-helpers/plugins/mock-users-plugin'),
|
|
38
|
+
require.resolve('@wmfs/tymly-test-helpers/plugins/mock-user-info-plugin')
|
|
38
39
|
]
|
|
39
40
|
}
|
|
40
41
|
)
|
|
@@ -152,6 +153,54 @@ describe('Tymly schedule tests', function () {
|
|
|
152
153
|
expect(catStats.length).to.eql(lastRunCount)
|
|
153
154
|
})
|
|
154
155
|
|
|
156
|
+
it('set scheduled task createdBy column', async () => {
|
|
157
|
+
await client.query(`UPDATE schedule.task SET _created_by = 'tymly.test@wmfs.net' where key='${scheduleKey}';`)
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('check the task update has persisted to the database', async () => {
|
|
161
|
+
const tasks = await taskModel.find({})
|
|
162
|
+
expect(tasks.length).to.eql(1)
|
|
163
|
+
expect(tasks[0].createdBy).to.eql('tymly.test@wmfs.net')
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
it('update task to specific date/time (again)', async () => {
|
|
167
|
+
const datetime = moment().utc().add(10, 'seconds').toDate()
|
|
168
|
+
console.log(`scheduled: ${datetime}`)
|
|
169
|
+
|
|
170
|
+
await scheduleService.stopAndUpdateTaskSchedule(
|
|
171
|
+
scheduleKey,
|
|
172
|
+
{
|
|
173
|
+
year: datetime.getFullYear(),
|
|
174
|
+
month: datetime.getMonth(),
|
|
175
|
+
date: datetime.getDate(),
|
|
176
|
+
hour: datetime.getHours(),
|
|
177
|
+
minute: datetime.getMinutes(),
|
|
178
|
+
second: datetime.getSeconds()
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
await scheduleService.startTask(scheduleKey)
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
it('wait 15 seconds', done => setTimeout(done, 15000))
|
|
186
|
+
|
|
187
|
+
it('check the state machine has run once more', async () => {
|
|
188
|
+
lastRunCount++
|
|
189
|
+
|
|
190
|
+
const tasks = await taskModel.find({})
|
|
191
|
+
expect(tasks.length).to.eql(1)
|
|
192
|
+
expect(tasks[0].interval).to.eql(null)
|
|
193
|
+
expect(tasks[0].datetime).to.not.eql(null)
|
|
194
|
+
expect(tasks[0].scheduleType).to.eql('datetime')
|
|
195
|
+
expect(tasks[0].status).to.eql('STARTED')
|
|
196
|
+
|
|
197
|
+
const executions = await scheduleService.findScheduledExecutions(scheduleKey)
|
|
198
|
+
expect(executions.length).to.eql(lastRunCount)
|
|
199
|
+
|
|
200
|
+
const catStats = await catStatsModel.find({})
|
|
201
|
+
expect(catStats.length).to.eql(lastRunCount)
|
|
202
|
+
})
|
|
203
|
+
|
|
155
204
|
it('shutdown Tymly', async () => {
|
|
156
205
|
await tymlyService.shutdown()
|
|
157
206
|
})
|
|
@@ -165,7 +214,8 @@ describe('Tymly schedule tests', function () {
|
|
|
165
214
|
pluginPaths: [
|
|
166
215
|
path.resolve(__dirname, '..'),
|
|
167
216
|
require.resolve('@wmfs/tymly-pg-plugin'),
|
|
168
|
-
require.resolve('@wmfs/tymly-test-helpers/plugins/mock-users-plugin')
|
|
217
|
+
require.resolve('@wmfs/tymly-test-helpers/plugins/mock-users-plugin'),
|
|
218
|
+
require.resolve('@wmfs/tymly-test-helpers/plugins/mock-user-info-plugin')
|
|
169
219
|
]
|
|
170
220
|
}
|
|
171
221
|
)
|