mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
refactor(api): co-locate server-protocol clients into lib/api
Move the Subsonic + Navidrome protocol clients and the library IPC facade (subsonic*, navidrome*, library.ts + tests) from src/api/ into src/lib/api/, the feature-free infra layer (plan M4, decision §10.3: shared client core → lib/). Pure move: deep-path import specifiers @/api/* -> @/lib/api/* across ~150 consumers; no behaviour change. Domain REST (lyrics/events) and cover/analysis infra stay in src/api/ pending their own M4 placement. tsc 0, lint 0/0, full suite 319 files / 2353 tests green.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { useAuthStore } from '@/store/authStore';
|
||||
import { api } from '@/api/subsonicClient';
|
||||
import type { InternetRadioStation, RadioBrowserStation } from '@/api/subsonicTypes';
|
||||
import { api } from '@/lib/api/subsonicClient';
|
||||
import type { InternetRadioStation, RadioBrowserStation } from '@/lib/api/subsonicTypes';
|
||||
|
||||
export async function getInternetRadioStations(): Promise<InternetRadioStation[]> {
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useEffect, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Cast, Globe, Heart, Square, Trash2, X } from 'lucide-react';
|
||||
import { open } from '@tauri-apps/plugin-shell';
|
||||
import type { InternetRadioStation } from '@/api/subsonicTypes';
|
||||
import type { InternetRadioStation } from '@/lib/api/subsonicTypes';
|
||||
import { useDragDrop, useDragSource } from '@/contexts/DragDropContext';
|
||||
import { CoverArtImage } from '@/cover/CoverArtImage';
|
||||
import { albumCoverRef } from '@/cover/ref';
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
} from '@/features/radio/api/subsonicRadio';
|
||||
import {
|
||||
type InternetRadioStation, type RadioBrowserStation, RADIO_PAGE_SIZE,
|
||||
} from '@/api/subsonicTypes';
|
||||
} from '@/lib/api/subsonicTypes';
|
||||
import { showToast } from '@/utils/ui/toast';
|
||||
|
||||
interface RadioDirectoryModalProps {
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { useRef, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Camera, Cast, Loader2, X } from 'lucide-react';
|
||||
import type { InternetRadioStation } from '@/api/subsonicTypes';
|
||||
import type { InternetRadioStation } from '@/lib/api/subsonicTypes';
|
||||
import { CoverArtImage } from '@/cover/CoverArtImage';
|
||||
import { albumCoverRef } from '@/cover/ref';
|
||||
import { coverArtIdFromRadio } from '@/cover/ids';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InternetRadioStation } from '@/api/subsonicTypes';
|
||||
import type { InternetRadioStation } from '@/lib/api/subsonicTypes';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { usePerfProbeFlags } from '@/utils/perf/perfFlags';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { useRadioMprisSync } from '@/features/radio/hooks/useRadioMprisSync';
|
||||
import type { RadioMetadata } from '@/features/radio/hooks/useRadioMetadata';
|
||||
import type { InternetRadioStation } from '@/api/subsonicTypes';
|
||||
import type { InternetRadioStation } from '@/lib/api/subsonicTypes';
|
||||
|
||||
vi.mock('@tauri-apps/api/core', () => ({ invoke: vi.fn(async () => undefined) }));
|
||||
const invokeMock = vi.mocked(invoke);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import type { InternetRadioStation } from '@/api/subsonicTypes';
|
||||
import type { InternetRadioStation } from '@/lib/api/subsonicTypes';
|
||||
import type { RadioMetadata } from '@/features/radio/hooks/useRadioMetadata';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getInternetRadioStations, createInternetRadioStation, updateInternetRadioStation, deleteInternetRadioStation, uploadRadioCoverArt, deleteRadioCoverArt } from '@/features/radio/api/subsonicRadio';
|
||||
import { type InternetRadioStation } from '@/api/subsonicTypes';
|
||||
import { type InternetRadioStation } from '@/lib/api/subsonicTypes';
|
||||
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
||||
import { Plus, Search } from 'lucide-react';
|
||||
import { usePlayerStore } from '@/store/playerStore';
|
||||
|
||||
Reference in New Issue
Block a user