@dereekb/util 9.11.0 → 9.11.2

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 CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [9.11.2](https://github.com/dereekb/dbx-components/compare/v9.11.1-dev...v9.11.2) (2022-10-09)
6
+
7
+
8
+
9
+ ## [9.11.1](https://github.com/dereekb/dbx-components/compare/v9.11.0-dev...v9.11.1) (2022-10-09)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * fixed cronExpressionRepeatingEveryNMinutes ([63a7f8c](https://github.com/dereekb/dbx-components/commit/63a7f8c48a2bf18c6b2ee712c47a71c95edbd35f))
15
+
16
+
17
+
5
18
  # [9.11.0](https://github.com/dereekb/dbx-components/compare/v9.10.4-dev...v9.11.0) (2022-10-09)
6
19
 
7
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "9.11.0",
3
+ "version": "9.11.2",
4
4
  "type": "commonjs",
5
5
  "exports": {
6
6
  ".": {
@@ -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
- export declare function cronExpressionRepeatingEveryNMinutes(minutes: Minutes): CronExpression;
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;
@@ -1,8 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cronExpressionRepeatingEveryNMinutes = void 0;
4
- function cronExpressionRepeatingEveryNMinutes(minutes) {
5
- return `*/${minutes} * * * *`; // every nth minute
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":";;;AAOA,SAAgB,oCAAoC,CAAC,OAAgB;IACnE,OAAO,KAAK,OAAO,UAAU,CAAC,CAAC,mBAAmB;AACpD,CAAC;AAFD,oFAEC"}
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,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [9.11.2](https://github.com/dereekb/dbx-components/compare/v9.11.1-dev...v9.11.2) (2022-10-09)
6
+
7
+
8
+
9
+ ## [9.11.1](https://github.com/dereekb/dbx-components/compare/v9.11.0-dev...v9.11.1) (2022-10-09)
10
+
11
+
12
+
5
13
  # [9.11.0](https://github.com/dereekb/dbx-components/compare/v9.10.4-dev...v9.11.0) (2022-10-09)
6
14
 
7
15
 
package/test/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "9.11.0",
3
+ "version": "9.11.2",
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.0",
9
+ "@dereekb/util": "9.11.2",
10
10
  "lodash.isequal": "^4.5.0",
11
11
  "make-error": "^1.3.0",
12
12
  "class-validator": "^0.13.2",