forked from GitHubMirrors/silverbullet-icalendar
Compare commits
15 Commits
33ca122583
...
6fc4282536
| Author | SHA1 | Date | |
|---|---|---|---|
| 6fc4282536 | |||
| 0a3b5aeaba | |||
| 12c417c506 | |||
| ca727c83d2 | |||
| f922f59145 | |||
| be74e906d2 | |||
| 10d334c732 | |||
| 9499dbffb2 | |||
| 9ea6f7961e | |||
| 7cc59ff5f9 | |||
| 974c75f01b | |||
| dcaf4d36a5 | |||
| 150fe04410 | |||
| 6b621083b9 | |||
| 4237fcfd30 |
2
PLUG.md
2
PLUG.md
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Library/sstent/icalendar
|
||||
version: "0.3.30"
|
||||
version: "0.3.31"
|
||||
tags: meta/library
|
||||
files:
|
||||
- icalendar.plug.js
|
||||
|
||||
@@ -14,5 +14,5 @@ This file tracks all major tracks for the project. Each track has its own detail
|
||||
|
||||
---
|
||||
|
||||
- [x] **Track: Fix issue where recurring meetings are not showing up.**
|
||||
*Link: [./tracks/fix_recurring_visibility_20260219/](./tracks/fix_recurring_visibility_20260219/)*
|
||||
- [x] **Track: Fix RRULE object expansion error by correctly mapping object keys to standard iCalendar RRULE properties.**
|
||||
*Link: [./tracks/fix_rrule_object_mapping_20260219/](./tracks/fix_rrule_object_mapping_20260219/)*
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Track fix_rrule_object_mapping_20260219 Context
|
||||
|
||||
- [Specification](./spec.md)
|
||||
- [Implementation Plan](./plan.md)
|
||||
- [Metadata](./metadata.json)
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"track_id": "fix_rrule_object_mapping_20260219",
|
||||
"type": "bug",
|
||||
"status": "new",
|
||||
"created_at": "2026-02-19T00:00:00Z",
|
||||
"updated_at": "2026-02-19T00:00:00Z",
|
||||
"description": "Fix RRULE object expansion error by correctly mapping object keys to standard iCalendar RRULE properties."
|
||||
}
|
||||
19
conductor/tracks/fix_rrule_object_mapping_20260219/plan.md
Normal file
19
conductor/tracks/fix_rrule_object_mapping_20260219/plan.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Implementation Plan - Fix RRULE Object Mapping
|
||||
|
||||
## Phase 1: Reproduction [checkpoint: 2fbb260]
|
||||
- [x] Task: Reproduce `Unknown RRULE property` error 0b67cbb
|
||||
- [x] Modify the test case in `icalendar_test.ts` to use `frequency` instead of `freq` in the mock object.
|
||||
- [x] Run the test and confirm it fails with the expected error.
|
||||
- [x] Task: Conductor - User Manual Verification 'Reproduction' (Protocol in workflow.md)
|
||||
|
||||
## Phase 2: Fix Implementation [checkpoint: fe28a5c]
|
||||
- [x] Task: Implement mapping logic in `icalendar.ts` b8bc6cc
|
||||
- [x] Create a mapping object for verbose keys to iCal keys.
|
||||
- [x] Update `expandRecurrences` to use this mapping.
|
||||
- [x] Run the test to confirm it passes.
|
||||
- [x] Task: Conductor - User Manual Verification 'Fix Implementation' (Protocol in workflow.md)
|
||||
|
||||
## Phase 3: Verification & Cleanup [checkpoint: 793326a]
|
||||
- [x] Task: Full Regression Check 7f9a618
|
||||
- [x] Run all tests in `icalendar_test.ts`.
|
||||
- [x] Task: Conductor - User Manual Verification 'Verification & Cleanup' (Protocol in workflow.md)
|
||||
32
conductor/tracks/fix_rrule_object_mapping_20260219/spec.md
Normal file
32
conductor/tracks/fix_rrule_object_mapping_20260219/spec.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Specification: Fix RRULE Object Expansion Error
|
||||
|
||||
## Overview
|
||||
The previous fix for handling object-type `rrule` properties (returned by `ts-ics`) introduced a regression. The conversion logic used uppercase full names (e.g., `FREQUENCY`), but the `rrule` library's `parseString` method expects standard iCalendar shortened keys (e.g., `FREQ`). This results in an `Error: Unknown RRULE property 'FREQUENCY'`.
|
||||
|
||||
## Functional Requirements
|
||||
- **Correct Key Mapping:** The logic that converts an `rrule` object back to a string must use standard iCalendar RRULE property keys.
|
||||
- **Mapping Table:**
|
||||
- `frequency` -> `FREQ`
|
||||
- `until` -> `UNTIL`
|
||||
- `count` -> `COUNT`
|
||||
- `interval` -> `INTERVAL`
|
||||
- `bysecond` -> `BYSECOND`
|
||||
- `byminute` -> `BYMINUTE`
|
||||
- `byhour` -> `BYHOUR`
|
||||
- `byday` -> `BYDAY`
|
||||
- `bymonthday` -> `BYMONTHDAY`
|
||||
- `byyearday` -> `BYYEARDAY`
|
||||
- `byweekno` -> `BYWEEKNO`
|
||||
- `bymonth` -> `BYMONTH`
|
||||
- `bysetpos` -> `BYSETPOS`
|
||||
- `wkst` -> `WKST`
|
||||
- **Case Insensitivity:** The mapping should be case-insensitive for the input object keys.
|
||||
|
||||
## Implementation Steps
|
||||
1. **Reproduce:** Update the existing `expandRecurrences - object rrule` test case to use the key `frequency` and verify it fails with the reported error.
|
||||
2. **Fix:** Implement a mapping function in `icalendar.ts` to translate object keys to standard RRULE keys before stringifying.
|
||||
3. **Verify:** Run the test case to confirm it now passes.
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Test `expandRecurrences - object rrule` passes with an object using `frequency` key.
|
||||
- [ ] No "Unknown RRULE property" errors are logged for valid RRULE objects.
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "icalendar-plug",
|
||||
"version": "0.3.30",
|
||||
"version": "0.3.31",
|
||||
"nodeModulesDir": "auto",
|
||||
"tasks": {
|
||||
"sync-version": "deno run -A scripts/sync-version.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: icalendar
|
||||
version: 0.3.30
|
||||
version: 0.3.31
|
||||
author: sstent
|
||||
index: icalendar.ts
|
||||
# Legacy SilverBullet permission name
|
||||
|
||||
28
icalendar.ts
28
icalendar.ts
@@ -3,11 +3,32 @@ import { convertIcsCalendar } from "https://esm.sh/ts-ics@2.4.0";
|
||||
import { RRule, RRuleSet } from "rrule";
|
||||
import { getUtcOffsetMs, resolveIanaName } from "./timezones.ts";
|
||||
|
||||
const VERSION = "0.3.30";
|
||||
const VERSION = "0.3.31";
|
||||
const CACHE_KEY = "icalendar:lastSync";
|
||||
|
||||
console.log(`[iCalendar] Plug script executing at top level (Version ${VERSION})`);
|
||||
|
||||
/**
|
||||
* Mapping of verbose RRULE object keys to standard iCalendar shortened keys.
|
||||
*/
|
||||
const RRULE_KEY_MAP: Record<string, string> = {
|
||||
"frequency": "FREQ",
|
||||
"until": "UNTIL",
|
||||
"count": "COUNT",
|
||||
"interval": "INTERVAL",
|
||||
"bysecond": "BYSECOND",
|
||||
"byminute": "BYMINUTE",
|
||||
"byhour": "BYHOUR",
|
||||
"byday": "BYDAY",
|
||||
"bymonthday": "BYMONTHDAY",
|
||||
"byyearday": "BYYEARDAY",
|
||||
"byweekno": "BYWEEKNO",
|
||||
"bymonth": "BYMONTH",
|
||||
"bysetpos": "BYSETPOS",
|
||||
"wkst": "WKST",
|
||||
"freq": "FREQ", // Just in case
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// Utility Functions
|
||||
// ============================================================================
|
||||
@@ -163,7 +184,10 @@ export function expandRecurrences(icsEvent: any, windowDays = 365): any[] {
|
||||
} else if (typeof rruleStr === "object" && rruleStr !== null) {
|
||||
// Handle object rrule (e.g. from ts-ics) by converting back to string
|
||||
cleanRule = Object.entries(rruleStr)
|
||||
.map(([k, v]) => `${k.toUpperCase()}=${v}`)
|
||||
.map(([k, v]) => {
|
||||
const standardKey = RRULE_KEY_MAP[k.toLowerCase()] || k.toUpperCase();
|
||||
return `${standardKey}=${v}`;
|
||||
})
|
||||
.join(";");
|
||||
} else {
|
||||
console.warn(`[iCalendar] Invalid rrule type (${typeof rruleStr}) for event "${icsEvent.summary || "Untitled"}". Treating as non-recurring.`);
|
||||
|
||||
@@ -182,7 +182,7 @@ Deno.test("expandRecurrences - object rrule (Reproduction of missing events)", (
|
||||
const icsEvent = {
|
||||
summary: "Object RRULE Event",
|
||||
start: startStr,
|
||||
rrule: { freq: "WEEKLY", byday: "MO" } // Simulating object rrule
|
||||
rrule: { frequency: "WEEKLY", byday: "MO" } // Simulating object rrule with verbose key
|
||||
};
|
||||
|
||||
// Spy on console.warn
|
||||
|
||||
Reference in New Issue
Block a user