@beauraines/rtm-api 1.11.0 → 1.13.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.
@@ -8,14 +8,14 @@ updates:
8
8
  - package-ecosystem: "npm" # See documentation for possible values
9
9
  directory: "/" # Location of package manifests
10
10
  schedule:
11
- interval: "weekly"
11
+ interval: "monthly"
12
12
  day: "friday"
13
13
  commit-message:
14
14
  prefix: fix
15
15
  prefix-development: chore
16
16
  include: scope
17
17
  groups:
18
- dev-dependencies:
19
- dependency-type: "development"
20
- patterns:
21
- - "*"
18
+ dev-dependencies:
19
+ dependency-type: "development"
20
+ patterns:
21
+ - "*"
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ## [1.11.0](https://github.com/beauraines/rtm-api/compare/v1.5.0...v1.11.0) (2024-06-24)
5
+ ## [1.13.0](https://github.com/beauraines/rtm-api/compare/v1.12.0...v1.13.0) (2025-12-17)
6
+
7
+
8
+ ### Features
9
+
10
+ * includes recurrence rule on RTMTask object ([#71](https://github.com/beauraines/rtm-api/issues/71)) ([9400a6e](https://github.com/beauraines/rtm-api/commit/9400a6e1376cec40e2ae3ffed3661357d551b65b)), closes [#66](https://github.com/beauraines/rtm-api/issues/66)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **deps:** bump debug from 4.3.5 to 4.4.0 ([#62](https://github.com/beauraines/rtm-api/issues/62)) ([fdd0986](https://github.com/beauraines/rtm-api/commit/fdd0986218fe4cca119d7b1c11ef3e45dbd12055)), closes [debug-js/debug#819](https://github.com/debug-js/debug/issues/819) [debug-js/debug#969](https://github.com/debug-js/debug/issues/969) [debug-js/debug#969](https://github.com/debug-js/debug/issues/969) [#819](https://github.com/beauraines/rtm-api/issues/819)
16
+
17
+ ## [1.12.0](https://github.com/beauraines/rtm-api/compare/v1.5.0...v1.12.0) (2024-06-24)
6
18
 
7
19
 
8
20
  ### Features
@@ -12,6 +24,7 @@ All notable changes to this project will be documented in this file. See [standa
12
24
 
13
25
  ### Bug Fixes
14
26
 
27
+ * **ci:** increment package number ([#48](https://github.com/beauraines/rtm-api/issues/48)) ([920f0c2](https://github.com/beauraines/rtm-api/commit/920f0c2857edd1a4c313edd03202f642df0ad6bb))
15
28
  * **deps:** bump debug from 4.3.4 to 4.3.5 ([269cc26](https://github.com/beauraines/rtm-api/commit/269cc2629ca7641f9e54f5f4578ebfab77c5879f))
16
29
  * **deps:** bump debug from 4.3.4 to 4.3.5 ([#46](https://github.com/beauraines/rtm-api/issues/46)) ([b488362](https://github.com/beauraines/rtm-api/commit/b488362b6beff5b293efb2a26b71640580a9e554))
17
30
  * **deps:** bump node-fetch from 2.6.11 to 2.7.0 ([#33](https://github.com/beauraines/rtm-api/issues/33)) ([37e41f2](https://github.com/beauraines/rtm-api/commit/37e41f2e174228c861f77b36c2da0242cb7e2c24)), closes [#1744](https://github.com/beauraines/rtm-api/issues/1744) [#1765](https://github.com/beauraines/rtm-api/issues/1765) [#1735](https://github.com/beauraines/rtm-api/issues/1735) [#1473](https://github.com/beauraines/rtm-api/issues/1473) [#1736](https://github.com/beauraines/rtm-api/issues/1736) [#1726](https://github.com/beauraines/rtm-api/issues/1726) [#1744](https://github.com/beauraines/rtm-api/issues/1744) [#1765](https://github.com/beauraines/rtm-api/issues/1765) [#1726](https://github.com/beauraines/rtm-api/issues/1726)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beauraines/rtm-api",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Remember the Milk API Interface",
5
5
  "author": "David Waring <dev@davidwaring.net> (https://davidwaring.net)",
6
6
  "contributors": [
@@ -18,7 +18,7 @@
18
18
  "main": "src/client/index.js",
19
19
  "scripts": {
20
20
  "docs": "jsdoc -c jsdoc.json --readme README.md --template node_modules/@dwaring87/docdash",
21
- "test": "jest --passWithNoTests",
21
+ "test": "jest",
22
22
  "lint": "eslint src",
23
23
  "lint:fix": "eslint src --fix",
24
24
  "release": "standard-version",
@@ -30,7 +30,7 @@
30
30
  "@eslint/js": "^9.5.0",
31
31
  "eslint": "^9.5.0",
32
32
  "eslint-plugin-jest": "^28.6.0",
33
- "globals": "^15.6.0",
33
+ "globals": "^16.0.0",
34
34
  "jest": "^29.4.3",
35
35
  "jsdoc": "^4.0.2"
36
36
  },
package/src/task/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const taskIds = require('../utils/taskIds.js');
4
+ const rruleToISODuration = require('../utils/rruleToDuration.js');
4
5
 
5
6
 
6
7
  /**
@@ -211,6 +212,15 @@ class RTMTask {
211
212
  */
212
213
  this.isRecurring = series.rrule ? true : false;
213
214
 
215
+ /**
216
+ * Task recurrence rule
217
+ * @type {string}}
218
+ */
219
+ this.recurrenceRule = series.rrule?.toString() === '' ? undefined : rruleToISODuration(series.rrule);
220
+ this.recurrenceRuleRaw = series.rrule?.toString() === '' ? undefined : JSON.stringify(series.rrule);
221
+
222
+
223
+
214
224
  /**
215
225
  * Task subtask flag
216
226
  * @type {boolean}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Convert an RTM-style rrule object into an ISO 8601 duration string.
5
+ * @param {{ $t: string }} rrule - Object with $t property like 'FREQ=DAILY;INTERVAL=1;WKST=SU'
6
+ * @returns {string} ISO 8601 duration string (e.g. 'P1D', 'PT3H')
7
+ * @throws {Error} on missing or unsupported frequency
8
+ */
9
+ function rruleToISODuration(rrule) {
10
+ if (!rrule || typeof rrule.$t !== 'string') {
11
+ throw new Error('Invalid rrule object');
12
+ }
13
+
14
+ const parts = rrule.$t
15
+ .split(';')
16
+ .map(p => p.split('='))
17
+ .reduce((acc, [k, v]) => {
18
+ acc[k] = v;
19
+ return acc;
20
+ }, {});
21
+
22
+ const freq = parts.FREQ;
23
+ const interval = parseInt(parts.INTERVAL || '1', 10);
24
+ const freqMap = {
25
+ YEARLY: 'Y',
26
+ MONTHLY: 'M',
27
+ WEEKLY: 'W',
28
+ DAILY: 'D',
29
+ HOURLY: 'H',
30
+ MINUTELY: 'M',
31
+ SECONDLY: 'S',
32
+ };
33
+
34
+ const designator = freqMap[freq];
35
+ if (!designator) {
36
+ throw new Error(`Unsupported FREQ: ${freq}`);
37
+ }
38
+
39
+ const timeBased = ['HOURLY', 'MINUTELY', 'SECONDLY'].includes(freq);
40
+ return `${timeBased ? 'PT' : 'P'}${interval}${designator}`;
41
+ }
42
+
43
+ module.exports = rruleToISODuration;
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ const rruleToISODuration = require('./rruleToDuration');
4
+
5
+ describe('rruleToISODuration', () => {
6
+ test('daily with explicit interval', () => {
7
+ const rrule = { $t: 'FREQ=DAILY;INTERVAL=1;WKST=SU' };
8
+ expect(rruleToISODuration(rrule)).toBe('P1D');
9
+ });
10
+
11
+ test('weekly without interval (defaults to 1)', () => {
12
+ const rrule = { $t: 'FREQ=WEEKLY;WKST=SU' };
13
+ expect(rruleToISODuration(rrule)).toBe('P1W');
14
+ });
15
+
16
+ test('monthly with interval 2', () => {
17
+ const rrule = { $t: 'FREQ=MONTHLY;INTERVAL=2' };
18
+ expect(rruleToISODuration(rrule)).toBe('P2M');
19
+ });
20
+
21
+ test('hourly with interval 3', () => {
22
+ const rrule = { $t: 'FREQ=HOURLY;INTERVAL=3' };
23
+ expect(rruleToISODuration(rrule)).toBe('PT3H');
24
+ });
25
+
26
+ test('minutely with interval 15', () => {
27
+ const rrule = { $t: 'FREQ=MINUTELY;INTERVAL=15' };
28
+ expect(rruleToISODuration(rrule)).toBe('PT15M');
29
+ });
30
+
31
+ test('secondly with interval 30', () => {
32
+ const rrule = { $t: 'FREQ=SECONDLY;INTERVAL=30' };
33
+ expect(rruleToISODuration(rrule)).toBe('PT30S');
34
+ });
35
+
36
+ test('unsupported frequency throws', () => {
37
+ const rrule = { $t: 'FREQ=UNKNOWN;INTERVAL=1' };
38
+ expect(() => rruleToISODuration(rrule)).toThrow('Unsupported FREQ: UNKNOWN');
39
+ });
40
+
41
+ test('invalid object throws', () => {
42
+ expect(() => rruleToISODuration(null)).toThrow('Invalid rrule object');
43
+ expect(() => rruleToISODuration({})).toThrow('Invalid rrule object');
44
+ });
45
+ });