diff --git a/packages/integrations/package.json b/packages/integrations/package.json index 887075526..9a3cd4202 100644 --- a/packages/integrations/package.json +++ b/packages/integrations/package.json @@ -38,7 +38,7 @@ "@homarr/redis": "workspace:^0.1.0", "@homarr/translation": "workspace:^0.1.0", "@homarr/validation": "workspace:^0.1.0", - "@immich/sdk": "^2.6.2", + "@immich/sdk": "^2.6.3", "@jellyfin/sdk": "^0.13.0", "@octokit/auth-app": "^8.2.0", "ical.js": "^2.2.1", diff --git a/packages/integrations/src/nextcloud/nextcloud.integration.ts b/packages/integrations/src/nextcloud/nextcloud.integration.ts index 5c8aabc90..7745be0e8 100644 --- a/packages/integrations/src/nextcloud/nextcloud.integration.ts +++ b/packages/integrations/src/nextcloud/nextcloud.integration.ts @@ -68,15 +68,19 @@ export class NextcloudIntegration extends Integration implements ICalendarIntegr return calendarEvents .map((event) => { - // @ts-expect-error the typescript definitions for this package are wrong + // @ts-expect-error the TypeScript definitions for this package are wrong // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access const icalData = ical.default.parseICS(event.data) as ical.CalendarResponse; - const veventObject = Object.values(icalData).find((data) => data.type === "VEVENT"); + const veventObject = Object.values(icalData).find((data) => data?.type === "VEVENT"); if (!veventObject) { throw new Error(`Invalid event data object: ${JSON.stringify(event.data)}. Unable to process the calendar.`); } + if (!veventObject.end) { + throw new Error(`Event had no end date: ${JSON.stringify(event.data)}. Unable to process the calendar.`); + } + logger.debug(`Converting VEVENT event to ${event.etag} from Nextcloud: ${JSON.stringify(veventObject)}`); const eventUrlWithoutHost = new URL(event.url).pathname; @@ -92,13 +96,13 @@ export class NextcloudIntegration extends Integration implements ICalendarIntegr const dateInMillis = utcStartDate.valueOf(); return { - title: veventObject.summary, + title: veventObject.summary as string, subTitle: null, - description: veventObject.description, + description: veventObject.description as string, startDate: utcStartDate, endDate, image: null, - location: veventObject.location || null, + location: (veventObject.location as string | undefined) ?? null, indicatorColor: "color" in veventObject && typeof veventObject.color === "string" ? veventObject.color : "#ff8600", links: [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e3291f009..278193b0c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1466,8 +1466,8 @@ importers: specifier: workspace:^0.1.0 version: link:../validation '@immich/sdk': - specifier: ^2.6.2 - version: 2.6.2 + specifier: ^2.6.3 + version: 2.6.3 '@jellyfin/sdk': specifier: ^0.13.0 version: 0.13.0(axios@1.12.2) @@ -3490,8 +3490,8 @@ packages: cpu: [x64] os: [win32] - '@immich/sdk@2.6.2': - resolution: {integrity: sha512-GDUOOyP4q6HDF8X9J/cHUX2sSrlWKKvMntvLgC8J1+vExGKx7FKxZnUybTHDzjefs6c0G8kpVN3UwgCEQXJNDA==} + '@immich/sdk@2.6.3': + resolution: {integrity: sha512-LPQPgmnzRl01aaTpaM3Ts26MM/8swVKKWhDG4DvWHosV2GW+d7+8v7fAEsP8u7z2kvT1h7PKvgLcxpBNGzS3cA==} '@inquirer/ansi@1.0.2': resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==} @@ -11939,7 +11939,7 @@ snapshots: '@img/sharp-win32-x64@0.34.5': optional: true - '@immich/sdk@2.6.2': + '@immich/sdk@2.6.3': dependencies: '@oazapfts/runtime': 1.2.0