@wmfs/tymly-schedule-plugin 1.1.0 → 1.2.0
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 +23 -0
- package/lib/components/services/schedule/index.js +5 -1
- package/lib/components/services/schedule/utils/datetime-to-rule.js +1 -1
- package/lib/components/state-resources/create-scheduled-task/index.js +1 -2
- package/package.json +5 -7
- package/plugin.json +1 -1
- package/test/rule-to-datetime-tests.js +2 -2
package/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
VERSION=1.
|
|
1
|
+
VERSION=1.2.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [1.2.0](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.1.0...v1.2.0) (2022-07-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ✨ Features
|
|
5
|
+
|
|
6
|
+
* updates for scheduled sending [sc-14535] ([8703224](https://github.com/wmfs/tymly-schedule-plugin/commit/8703224e3c1cf8a0ba93be3027eafa64841cfc4f))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update unit tests for datetime [sc-14535] ([155d3a5](https://github.com/wmfs/tymly-schedule-plugin/commit/155d3a544f6dcb9cf22c95713b5bd62a6a2d45c9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### 🛠 Builds
|
|
15
|
+
|
|
16
|
+
* **deps-dev:** update dependency [@wmfs](https://github.com/wmfs)/tymly-pg-plugin to v1.268.1 ([0bd7069](https://github.com/wmfs/tymly-schedule-plugin/commit/0bd7069404eadf1d08e3824ed1ce9d1ff6816cfc))
|
|
17
|
+
* **deps-dev:** update dependency [@wmfs](https://github.com/wmfs)/tymly-test-helpers to v1.17.0 ([e9202a6](https://github.com/wmfs/tymly-schedule-plugin/commit/e9202a6cd86dc8429dfa1d077bccdef985231d85))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### ♻️ Chores
|
|
21
|
+
|
|
22
|
+
* enable tymly sync ([58ce844](https://github.com/wmfs/tymly-schedule-plugin/commit/58ce844d32d72c4be3c7cd19d230a99b6b53db6f))
|
|
23
|
+
|
|
1
24
|
# [1.1.0](https://github.com/wmfs/tymly-schedule-plugin/compare/v1.0.1...v1.1.0) (2022-03-16)
|
|
2
25
|
|
|
3
26
|
|
|
@@ -3,6 +3,7 @@ const INSTIGATING_CLIENT_DOMAIN = 'tymly-schedule-plugin'
|
|
|
3
3
|
const nodeSchedule = require('node-schedule')
|
|
4
4
|
const ruleToDatetime = require('./utils/rule-to-datetime')
|
|
5
5
|
const datetimeToRule = require('./utils/datetime-to-rule')
|
|
6
|
+
const { v4: uuidv4 } = require('uuid')
|
|
6
7
|
|
|
7
8
|
class CronService {
|
|
8
9
|
async boot (options) {
|
|
@@ -54,7 +55,6 @@ class CronService {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
// todo: allow window for start/end datetimes
|
|
57
|
-
|
|
58
58
|
task.job = nodeSchedule.scheduleJob(
|
|
59
59
|
jobOptions,
|
|
60
60
|
() => {
|
|
@@ -264,6 +264,10 @@ class CronService {
|
|
|
264
264
|
} // findScheduledExecutions
|
|
265
265
|
|
|
266
266
|
createScheduledTask (key, config = {}) {
|
|
267
|
+
if (key === null) {
|
|
268
|
+
console.log('no key, generating...')
|
|
269
|
+
key = uuidv4()
|
|
270
|
+
}
|
|
267
271
|
this.scheduledTasks[key] = config
|
|
268
272
|
return this.persistTask(key, config)
|
|
269
273
|
} // createScheduledTask
|
|
@@ -48,8 +48,7 @@ class CreateScheduledTask {
|
|
|
48
48
|
await this.services.schedule.createScheduledTask(key, config)
|
|
49
49
|
// await this.services.schedule.stopAndUpdateTaskSchedule(key, rule)
|
|
50
50
|
// await this.services.schedule.stopAndUpdateStateMachineConfig(key, stateMachineName, input)
|
|
51
|
-
|
|
52
|
-
return context.sendTaskSuccess()
|
|
51
|
+
return context.sendTaskSuccess(key)
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wmfs/tymly-schedule-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|
|
@@ -22,15 +22,16 @@
|
|
|
22
22
|
},
|
|
23
23
|
"main": "./lib/index.js",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"node-schedule": "2.1.0"
|
|
25
|
+
"node-schedule": "2.1.0",
|
|
26
|
+
"uuid": "^8.3.2"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@semantic-release/changelog": "6.0.1",
|
|
29
30
|
"@semantic-release/exec": "6.0.3",
|
|
30
31
|
"@semantic-release/git": "10.0.1",
|
|
31
32
|
"@wmfs/tymly": "1.235.1",
|
|
32
|
-
"@wmfs/tymly-pg-plugin": "1.268.
|
|
33
|
-
"@wmfs/tymly-test-helpers": "1.
|
|
33
|
+
"@wmfs/tymly-pg-plugin": "1.268.1",
|
|
34
|
+
"@wmfs/tymly-test-helpers": "1.17.0",
|
|
34
35
|
"chai": "4.3.6",
|
|
35
36
|
"codecov": "3.8.3",
|
|
36
37
|
"conventional-changelog-metahub": "4.0.1",
|
|
@@ -51,9 +52,6 @@
|
|
|
51
52
|
"config": {
|
|
52
53
|
"commitizen": {
|
|
53
54
|
"path": "cz-conventional-changelog"
|
|
54
|
-
},
|
|
55
|
-
"tymly": {
|
|
56
|
-
"sync": false
|
|
57
55
|
}
|
|
58
56
|
},
|
|
59
57
|
"publishConfig": {
|
package/plugin.json
CHANGED
|
@@ -81,7 +81,7 @@ describe('Datetime to rule tests', function () {
|
|
|
81
81
|
expect(rule.year).to.eql(now.getFullYear())
|
|
82
82
|
expect(rule.month).to.eql(now.getMonth())
|
|
83
83
|
expect(rule.date).to.eql(now.getDate())
|
|
84
|
-
expect(rule.hour).to.eql(now.getHours())
|
|
84
|
+
expect(rule.hour).to.eql(now.getHours() - 1)
|
|
85
85
|
expect(rule.minute).to.eql(now.getMinutes())
|
|
86
86
|
expect(rule.second).to.eql(now.getSeconds())
|
|
87
87
|
})
|
|
@@ -96,7 +96,7 @@ describe('Datetime to rule tests', function () {
|
|
|
96
96
|
expect(rule.year).to.eql(year)
|
|
97
97
|
expect(rule.month).to.eql(datetime.getMonth())
|
|
98
98
|
expect(rule.date).to.eql(datetime.getDate())
|
|
99
|
-
expect(rule.hour).to.eql(datetime.getHours())
|
|
99
|
+
expect(rule.hour).to.eql(datetime.getHours() - 1)
|
|
100
100
|
expect(rule.minute).to.eql(datetime.getMinutes())
|
|
101
101
|
expect(rule.second).to.eql(datetime.getSeconds())
|
|
102
102
|
})
|