From 66db4d017e6d1849a5dd003d8d2d7de98159e546 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Thu, 9 Jul 2026 12:17:03 +0000 Subject: [PATCH] more fixes to get all tests passing --- .../common/vendor/teal/TealApiClient.ts | 2 +- src/backend/sources/JellyfinApiSource.ts | 51 ++++++++----------- src/backend/sources/MopidySource.ts | 2 +- src/backend/tests/jellyfin/jellyfin.test.ts | 4 +- 4 files changed, 25 insertions(+), 34 deletions(-) diff --git a/src/backend/common/vendor/teal/TealApiClient.ts b/src/backend/common/vendor/teal/TealApiClient.ts index e12084e4..30a2e676 100644 --- a/src/backend/common/vendor/teal/TealApiClient.ts +++ b/src/backend/common/vendor/teal/TealApiClient.ts @@ -1,4 +1,4 @@ -import dayjs, { Dayjs, type ManipulateType } from "dayjs"; +import dayjs, { type Dayjs, type ManipulateType } from "dayjs"; import { type PlayObject, type PlayObjectMinimal, type BrainzMeta, type MBID, type ScrobbleActionResult, type UnixTimestamp } from "../../../../core/Atomic.ts"; import { getRoot } from "../../../ioc.ts"; import { removeUndefinedKeys } from '../../../../core/DataUtils.ts'; diff --git a/src/backend/sources/JellyfinApiSource.ts b/src/backend/sources/JellyfinApiSource.ts index 0ac8b67f..a47ab43c 100644 --- a/src/backend/sources/JellyfinApiSource.ts +++ b/src/backend/sources/JellyfinApiSource.ts @@ -1,66 +1,57 @@ -import { type Logger } from "@foxxmd/logging"; import { WS } from "iso-websocket"; // @ts-expect-error weird typings? import { Api, Jellyfin } from "@jellyfin/sdk"; import { // @ts-expect-error weird typings? - AuthenticationResult, + type BaseItemDto, // @ts-expect-error weird typings? - BaseItemDto, + type CollectionType, // @ts-expect-error weird typings? - BaseItemKind, - // @ts-expect-error weird typings? - ItemSortBy, + type ImageUrlsApi, // @ts-expect-error weird typings? MediaType, // @ts-expect-error weird typings? - SessionInfo, + type SessionInfo, + // @ts-expect-error weird typings? + type UserDto, // @ts-expect-error weird typings? - SortOrder, UserDto, VirtualFolderInfo, CollectionType, CollectionTypeOptions, ImageUrlsApi + type VirtualFolderInfo } from "@jellyfin/sdk/lib/generated-client/index.js"; import { // @ts-expect-error weird typings? - getItemsApi, - // @ts-expect-error weird typings? - getSessionApi, + SystemInfoIssue +} from "@jellyfin/sdk/lib/index.js"; +import { // @ts-expect-error weird typings? - getSystemApi, + getImageApi, // @ts-expect-error weird typings? - getUserApi, + getLibraryStructureApi, // @ts-expect-error weird typings? - getApiKeyApi, + getSessionApi, // @ts-expect-error weird typings? - getLibraryStructureApi, + getSystemApi, // @ts-expect-error weird typings? - getImageApi, - + getUserApi } from "@jellyfin/sdk/lib/utils/api/index.js"; -import { - // @ts-expect-error weird typings? - SystemInfoIssue -} -from "@jellyfin/sdk/lib/index.js"; import dayjs from "dayjs"; import EventEmitter from "events"; +import { FixedSizeList } from "fixed-size-list"; import { type ArtistCredit, type BrainzMeta, type PlayObject, type PlayObjectMinimal } from "../../core/Atomic.ts"; -import { artistNamesToCredits, artistNameToCredit, buildTrackString, combinePartsToString, truncateStringToLength } from "../../core/StringUtils.ts"; +import { genGroupIdStr } from '../../core/PlayUtils.ts'; +import { artistNameToCredit, buildTrackString, combinePartsToString, truncateStringToLength } from "../../core/StringUtils.ts"; import { type FormatPlayObjectOptions, type InternalConfig, - type PlayerStateData, type PlayerStateDataMaybePlay, REPORTED_PLAYER_STATUSES } from "../common/infrastructure/Atomic.ts"; -import { type PlayPlatformId } from '../../core/Atomic.ts'; import { type JellyApiSourceConfig } from "../common/infrastructure/config/source/jellyfin.ts"; -import { getPlatformIdFromData, isDebugMode, parseBool, } from "../utils.ts"; -import { genGroupIdStr } from '../../core/PlayUtils.ts'; +import { getPlatformIdFromData, isDebugMode } from "../utils.ts"; +import { noCasePropObj } from "../utils/DataUtils.ts"; import { joinedUrl } from "../utils/NetworkUtils.ts"; +import { baseFormatPlayObj } from "../utils/PlayTransformUtils.ts"; import { hashObject, parseArrayFromMaybeString } from "../utils/StringUtils.ts"; import { MemoryPositionalSource } from "./MemoryPositionalSource.ts"; -import { FixedSizeList } from "fixed-size-list"; -import { baseFormatPlayObj } from "../utils/PlayTransformUtils.ts"; -import { noCasePropObj } from "../utils/DataUtils.ts"; const shortDeviceId = truncateStringToLength(10, ''); diff --git a/src/backend/sources/MopidySource.ts b/src/backend/sources/MopidySource.ts index b947a19d..e12652c8 100644 --- a/src/backend/sources/MopidySource.ts +++ b/src/backend/sources/MopidySource.ts @@ -1,7 +1,7 @@ import { loggerTest } from "@foxxmd/logging"; import dayjs from "dayjs"; import { EventEmitter } from "events"; -import Mopidy, { models } from "mopidy"; +import Mopidy, { type models } from "mopidy"; import normalizeUrl from 'normalize-url'; import pEvent from 'p-event'; import { URL } from "url"; diff --git a/src/backend/tests/jellyfin/jellyfin.test.ts b/src/backend/tests/jellyfin/jellyfin.test.ts index f13e1fcf..f5cb4f8f 100644 --- a/src/backend/tests/jellyfin/jellyfin.test.ts +++ b/src/backend/tests/jellyfin/jellyfin.test.ts @@ -2,14 +2,14 @@ import { loggerTest } from "@foxxmd/logging"; import { assert, expect } from 'chai'; import EventEmitter from "events"; import { describe, it } from 'mocha'; -import { type JsonPlayObject, type PlayMeta, type PlayObject } from "../../../core/Atomic.ts"; +import { type JsonPlayObject, type PlayMeta } from "../../../core/Atomic.ts"; import JellyfinApiSource from "../../sources/JellyfinApiSource.ts"; import validSession from './validSession.json' with { type: "json" }; import { type JellyApiData } from "../../common/infrastructure/config/source/jellyfin.ts"; import { generatePlay } from "../../../core/PlayTestUtils.ts"; import { faker, fakerJA } from "@faker-js/faker"; -import { +import type { // @ts-expect-error weird typings? SessionInfo, // @ts-expect-error weird typings? -- 2.51.2