Update dependencies and refactor validation logic#426
Draft
Update dependencies and refactor validation logic#426
Conversation
- Updated `zod` from version 3.25.76 to 4.1.13 in `package.json`. - Updated `material-symbols` from version 0.39.1 to 0.40.0 in `package.json`. - Refactored validation logic in various routes to directly use `zod` schemas instead of `zodValidator` from `@tanstack/zod-adapter`. - Updated routes in `albums`, `artists`, `folders`, `genres`, `lyrics`, `playlists`, `queue`, and `search` to reflect the new validation approach.
…audio metadata handling
…tadata and update related imports - Renamed `sendSongId3Tags` to `sendSongMetadata` across multiple files for clarity. - Updated the function signature in `songs.ts` to reflect the new naming convention. - Removed the old `sendSongId3Tags` implementation and replaced it with the new `sendSongMetadata` logic. - Adjusted all relevant imports and usages to ensure consistency throughout the codebase.
- Introduced a new script `colorize-logs.ts` for colorizing and tailing NDJSON log files. - The script supports various features including log level filtering, file selection, and pretty-printing of log data. - Added a new npm command `logs` to execute the log viewer script with an optional environment log path.
- Implemented `testUtils.ts` to provide mock data and utility functions for testing song metadata, file stats, and database transactions. - Created comprehensive tests in `tryToParseSong.test.ts` to cover various scenarios including duplicate prevention, success cases, retry logic, renderer messages, and edge cases. - Mocked dependencies such as file system operations, database queries, and external libraries to isolate tests and ensure reliability. - Enhanced test coverage for song parsing logic, ensuring robust handling of different paths and error scenarios.
…nres, and artists; enhance song metadata update process
- Updated function signatures and variable types in various modules to use number for songId instead of string. - Adjusted related database queries and IPC handlers to accommodate the new type. - Modified local storage migration to convert songId from string to number. - Updated type definitions in app.d.ts to reflect changes in songId type. - Ensured consistency in handling songId throughout the application, including in event data and song-related operations.
Updated the README to enhance clarity and structure, including a new introduction and improved feature descriptions.
…and queries - Updated toggleSongIsFavorite to accept songId as a number. - Modified updateQueueOnSongPlay to handle songId as a number and adjusted queue structure accordingly. - Changed album, artist, genre, listen, playlist, and song queries to use number for songId and related identifiers. - Adjusted route parameters in main-player routes to convert string params to numbers for songId, albumId, artistId, genreId, and playlistId. - Updated local storage utility functions to handle number arrays instead of string arrays for ignored artists and songs. - Refined metadata management functions to ensure consistent handling of artist and genre data. - Adjusted types in app.d.ts to reflect changes in songId and related identifiers. - Fixed various instances in the UI where songId was treated as a string instead of a number.
…s to use enums - Changed import paths for conversion functions in multiple files to use '../utils/convert' instead of '../../common/convert'. - Updated playlist IDs in the filesystem and related components to use the SpecialPlaylists enum for better maintainability. - Adjusted types for song and album data structures to use numbers instead of strings where applicable. - Modified API calls to handle data responses correctly in various components. - Cleaned up unused parameters and improved code readability across several files.
…rseSong and related tests
… in recursive calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a variety of improvements and updates across the codebase, focusing on dependency upgrades, environment configuration, playlist management, and documentation. The most significant changes are grouped below by theme.
Dependency and Build System Updates:
package.json, includingdrizzle-orm,electron-vite,material-symbols, andzod, and added new dependencies such asnode-taglib-sharpandyoctocolors. [1] [2] [3] [4] [5]electron.vite.config.tsto remove the use ofexternalizeDepsPluginand ensure compatibility with the newelectron-viteversion. [1] [2]Environment and Configuration:
.env.examplefile with placeholders for all required environment variables, improving developer onboarding and configuration clarity.Playlist Management Improvements:
numbertypes forplaylistIdandsongIdsinstead ofstring, enhancing type safety and reliability in functions likeaddSongsToPlaylist,addArtworkToAPlaylist, andblacklistSongs. [1] [2] [3] [4]SpecialPlaylistsenum insrc/common/playlists.enum.tsto better handle special playlist IDs such as History and Favorites.Documentation and Developer Experience:
README.mdfor improved clarity, structure, and user engagement, including new feature lists, gallery, feedback/contribution sections, and clearer build instructions. [1] [2]logsscript inpackage.jsonfor easier log colorization and access.Path and Import Fixes:
These changes collectively improve the robustness, maintainability, and usability of the project.Upgrade
zodandmaterial-symbolsdependencies. Refactor validation logic to directly utilizezodschemas across various routes, removing reliance onzod-adapter. This change streamlines validation processes and enhances code maintainability.