@dereekb/util 9.11.0 → 9.11.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/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/src/lib/value/cron.d.ts +11 -1
- package/src/lib/value/cron.js +23 -2
- package/src/lib/value/cron.js.map +1 -1
- package/test/CHANGELOG.md +4 -0
- package/test/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.11.1](https://github.com/dereekb/dbx-components/compare/v9.11.0-dev...v9.11.1) (2022-10-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* fixed cronExpressionRepeatingEveryNMinutes ([63a7f8c](https://github.com/dereekb/dbx-components/commit/63a7f8c48a2bf18c6b2ee712c47a71c95edbd35f))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
5
14
|
# [9.11.0](https://github.com/dereekb/dbx-components/compare/v9.10.4-dev...v9.11.0) (2022-10-09)
|
|
6
15
|
|
|
7
16
|
|
package/package.json
CHANGED
package/src/lib/value/cron.d.ts
CHANGED
|
@@ -3,4 +3,14 @@ import { Minutes } from '../date/date';
|
|
|
3
3
|
* A cron schedule expression string
|
|
4
4
|
*/
|
|
5
5
|
export declare type CronExpression = string;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Creates a CronExpression for the input number of minutes.
|
|
8
|
+
*
|
|
9
|
+
* Note that if the number of minutes is greater than 60, it will generate an expression that
|
|
10
|
+
* isn't exactly n number of minutes apart from the previous execution, but instead create
|
|
11
|
+
* an expression that is n/60 hours apart and take place on the n%60th minute.
|
|
12
|
+
*
|
|
13
|
+
* @param inputMinutes
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function cronExpressionRepeatingEveryNMinutes(inputMinutes: Minutes): CronExpression;
|
package/src/lib/value/cron.js
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cronExpressionRepeatingEveryNMinutes = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Creates a CronExpression for the input number of minutes.
|
|
6
|
+
*
|
|
7
|
+
* Note that if the number of minutes is greater than 60, it will generate an expression that
|
|
8
|
+
* isn't exactly n number of minutes apart from the previous execution, but instead create
|
|
9
|
+
* an expression that is n/60 hours apart and take place on the n%60th minute.
|
|
10
|
+
*
|
|
11
|
+
* @param inputMinutes
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
function cronExpressionRepeatingEveryNMinutes(inputMinutes) {
|
|
15
|
+
let minutes;
|
|
16
|
+
let hours;
|
|
17
|
+
let expression;
|
|
18
|
+
if (inputMinutes >= 60) {
|
|
19
|
+
hours = Math.floor(inputMinutes / 60);
|
|
20
|
+
minutes = inputMinutes % 60;
|
|
21
|
+
expression = `${minutes} */${hours} * * *`; // every nth hour at the given minute
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
expression = `*/${inputMinutes} * * * *`; // every nth minute
|
|
25
|
+
}
|
|
26
|
+
return expression;
|
|
6
27
|
}
|
|
7
28
|
exports.cronExpressionRepeatingEveryNMinutes = cronExpressionRepeatingEveryNMinutes;
|
|
8
29
|
//# sourceMappingURL=cron.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cron.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/value/cron.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cron.js","sourceRoot":"","sources":["../../../../../../packages/util/src/lib/value/cron.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;;GASG;AACH,SAAgB,oCAAoC,CAAC,YAAqB;IACxE,IAAI,OAAgB,CAAC;IACrB,IAAI,KAAmB,CAAC;IAExB,IAAI,UAA0B,CAAC;IAE/B,IAAI,YAAY,IAAI,EAAE,EAAE;QACtB,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;QACtC,OAAO,GAAG,YAAY,GAAG,EAAE,CAAC;QAE5B,UAAU,GAAG,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,qCAAqC;KAClF;SAAM;QACL,UAAU,GAAG,KAAK,YAAY,UAAU,CAAC,CAAC,mBAAmB;KAC9D;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAhBD,oFAgBC"}
|
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [9.11.1](https://github.com/dereekb/dbx-components/compare/v9.11.0-dev...v9.11.1) (2022-10-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
# [9.11.0](https://github.com/dereekb/dbx-components/compare/v9.10.4-dev...v9.11.0) (2022-10-09)
|
|
6
10
|
|
|
7
11
|
|
package/test/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/test",
|
|
3
|
-
"version": "9.11.
|
|
3
|
+
"version": "9.11.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/util": "9.11.
|
|
9
|
+
"@dereekb/util": "9.11.1",
|
|
10
10
|
"lodash.isequal": "^4.5.0",
|
|
11
11
|
"make-error": "^1.3.0",
|
|
12
12
|
"class-validator": "^0.13.2",
|