@behindthemusictree/app-kit 39.0.0 → 40.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +2 -2
- package/dist/{chunk-7S6EALIP.js → chunk-AYAKFCBP.js} +2 -2
- package/dist/{chunk-FNRF3IL3.js → chunk-D5UFJF4K.js} +45 -32
- package/dist/chunk-D5UFJF4K.js.map +1 -0
- package/dist/{chunk-5YLNSX34.js → chunk-MF7SJIEY.js} +2 -2
- package/dist/{chunk-T5D5T52J.js → chunk-WL2TKQVN.js} +7 -1
- package/dist/chunk-WL2TKQVN.js.map +1 -0
- package/dist/genre-tree/index.cjs +50 -30
- package/dist/genre-tree/index.cjs.map +1 -1
- package/dist/genre-tree/index.d.ts +31 -15
- package/dist/genre-tree/index.js +7 -5
- package/dist/index.cjs +50 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/transport/index.cjs +6 -0
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-FNRF3IL3.js.map +0 -1
- package/dist/chunk-T5D5T52J.js.map +0 -1
- /package/dist/{chunk-7S6EALIP.js.map → chunk-AYAKFCBP.js.map} +0 -0
- /package/dist/{chunk-5YLNSX34.js.map → chunk-MF7SJIEY.js.map} +0 -0
|
@@ -3963,7 +3963,7 @@ interface UseGenreTreeViewStateOptions<O extends CriteriaOverview = CriteriaOver
|
|
|
3963
3963
|
getBackendBaseUrl: () => string;
|
|
3964
3964
|
/** Controlled view mode; when provided the hook never changes it. */
|
|
3965
3965
|
viewMode?: GenreViewMode;
|
|
3966
|
-
/**
|
|
3966
|
+
/** Projects this artist onto the tree (see `useVisibleGenrePlaylists`). */
|
|
3967
3967
|
artistUuid?: string | null;
|
|
3968
3968
|
/** Entity selection is independent of the visible renderer nodes. */
|
|
3969
3969
|
selectedGenreUuid?: GenreUuid | null;
|
|
@@ -3975,9 +3975,11 @@ interface UseGenreTreeViewStateResult {
|
|
|
3975
3975
|
/** The tree failed to load and nothing is cached. `genrePlaylists` is empty, which is not "no genres". */
|
|
3976
3976
|
isError: boolean;
|
|
3977
3977
|
refetch: () => void;
|
|
3978
|
-
/** True while the visible tree is being refreshed or re-
|
|
3978
|
+
/** True while the visible tree is being refreshed or re-projected; the previous tree stays in `genrePlaylists`. */
|
|
3979
3979
|
isFetching: boolean;
|
|
3980
3980
|
genrePlaylists: CriteriaPlaylistSimple[];
|
|
3981
|
+
/** The open artist's footprint; undefined without an artist. Nodes outside it are rendered muted. */
|
|
3982
|
+
focusUuids: ReadonlySet<string> | undefined;
|
|
3981
3983
|
genrePlaylistByNodeId: Map<string, CriteriaPlaylistSimple>;
|
|
3982
3984
|
/** Playlists the current view mode may show: unaccepted roots and, outside stacked/outline, criteria-less playlists are hidden. */
|
|
3983
3985
|
visibleGenrePlaylists: CriteriaPlaylistSimple[];
|
|
@@ -4009,16 +4011,16 @@ declare function useGenreTreeViewState<O extends CriteriaOverview = CriteriaOver
|
|
|
4009
4011
|
interface UseVisibleGenrePlaylistsOptions {
|
|
4010
4012
|
scope: Scope;
|
|
4011
4013
|
getBackendBaseUrl: () => string;
|
|
4012
|
-
/** When set, the tree
|
|
4014
|
+
/** When set, the tree carries this artist's counts and `focusUuids` marks their footprint. */
|
|
4013
4015
|
artistUuid?: string | null;
|
|
4014
4016
|
}
|
|
4015
4017
|
/**
|
|
4016
|
-
* The tree the user can navigate: the whole canonical tree
|
|
4017
|
-
*
|
|
4018
|
-
*
|
|
4019
|
-
* `isFetching` is true; `isLoading`
|
|
4020
|
-
*
|
|
4021
|
-
* is shown.
|
|
4018
|
+
* The tree the user can navigate: always the whole canonical tree. When `artistUuid` is set it
|
|
4019
|
+
* carries the artist's counts and `focusUuids` names their footprint (undefined otherwise); genres
|
|
4020
|
+
* outside it stay navigable and renderers draw them muted. While the artist's counts load the
|
|
4021
|
+
* current tree stays (with the previous artist's projection) and `isFetching` is true; `isLoading`
|
|
4022
|
+
* is true only until the first tree arrives. If the counts fail (unknown artist, backend error) the
|
|
4023
|
+
* plain tree is served, the artist panel being where that failure is shown.
|
|
4022
4024
|
*/
|
|
4023
4025
|
declare function useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid }: UseVisibleGenrePlaylistsOptions): {
|
|
4024
4026
|
isLoading: boolean;
|
|
@@ -4110,6 +4112,7 @@ declare function useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid
|
|
|
4110
4112
|
isUmbrella?: boolean | undefined;
|
|
4111
4113
|
scene?: "commercial" | "underground" | null | undefined;
|
|
4112
4114
|
}[];
|
|
4115
|
+
focusUuids: ReadonlySet<string> | undefined;
|
|
4113
4116
|
};
|
|
4114
4117
|
|
|
4115
4118
|
declare const SubgenreCountsSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
@@ -4277,6 +4280,13 @@ declare class TrackListFromArtist<T extends TrackBase = TrackBase> extends Track
|
|
|
4277
4280
|
constructor(tracks: T[], origin: TrackListOriginFromArtist, total: number, nextPage: number | null);
|
|
4278
4281
|
}
|
|
4279
4282
|
|
|
4283
|
+
/**
|
|
4284
|
+
* The tracks request failed and the global connectivity popup (or a newer request replacing this one) already
|
|
4285
|
+
* accounts for it; callers must not show a second popup.
|
|
4286
|
+
*/
|
|
4287
|
+
declare class TracksFailureAlreadyReportedError extends Error {
|
|
4288
|
+
constructor();
|
|
4289
|
+
}
|
|
4280
4290
|
declare function useListTracks<T>(scope: Scope | null, getBackendBaseUrl: () => string, schema: z.ZodType<T, unknown>, listEndpoint: (page: number) => string, listQueryKey: (page: number) => readonly unknown[], page?: number, pageSize?: number | string): _tanstack_react_query.UseQueryResult<NoInfer<{
|
|
4281
4291
|
overallTotal: number;
|
|
4282
4292
|
next: string | null;
|
|
@@ -4783,13 +4793,19 @@ declare const hasMainstreamPopRoot: (nodes: {
|
|
|
4783
4793
|
name: string;
|
|
4784
4794
|
}[]) => boolean;
|
|
4785
4795
|
|
|
4796
|
+
interface ArtistGenreProjection {
|
|
4797
|
+
/** Every canonical playlist, carrying the artist's counts (zero outside the footprint). */
|
|
4798
|
+
genrePlaylists: CriteriaPlaylistSimple[];
|
|
4799
|
+
/** The artist's footprint: renderers draw every other node muted instead of dropping it. */
|
|
4800
|
+
focusUuids: ReadonlySet<string>;
|
|
4801
|
+
}
|
|
4786
4802
|
/**
|
|
4787
|
-
*
|
|
4788
|
-
*
|
|
4789
|
-
*
|
|
4790
|
-
*
|
|
4803
|
+
* Projects an artist onto the canonical tree. No node is dropped: every playlist carries the
|
|
4804
|
+
* artist's counts (zero outside the footprint). The footprint is the nodes with songs in their
|
|
4805
|
+
* subtree, which includes every ancestor of such a node; an artist without genres has an empty
|
|
4806
|
+
* footprint. Since nothing is pruned, no structural node needs to be kept in focus.
|
|
4791
4807
|
*/
|
|
4792
|
-
declare const
|
|
4808
|
+
declare const projectGenrePlaylistsForArtist: (playlists: CriteriaPlaylistSimple[], counts: ArtistGenreCount[]) => ArtistGenreProjection;
|
|
4793
4809
|
|
|
4794
4810
|
/** Ranked, accent-insensitive name match (exact, prefix, substring, fuzzy). An empty/whitespace query matches nothing. */
|
|
4795
4811
|
declare const searchGenrePlaylistsByName: <T extends CriteriaPlaylistSimple>(genrePlaylists: T[], query: string) => T[];
|
|
@@ -4987,4 +5003,4 @@ declare const ReferenceGenrePlaylistSchema: z.ZodObject<{
|
|
|
4987
5003
|
type ReferenceGenreDetailed = z.infer<typeof ReferenceGenreDetailedSchema>;
|
|
4988
5004
|
type ReferenceGenrePlaylist = z.infer<typeof ReferenceGenrePlaylistSchema>;
|
|
4989
5005
|
|
|
4990
|
-
export { ARTIST_LINK_KINDS, type AlbumMinimum, AlbumMinimumSchema, type ArtistAlbum, type ArtistDetailed, ArtistDetailedSchema, type ArtistGenreCount, ArtistGenreCountSchema, type ArtistImage, ArtistImageSchema, type ArtistLink, type ArtistMembership, type ArtistMinimum, ArtistMinimumSchema, ArtistNames, type ArtistSearchResult, ArtistSearchResultSchema, ArtistSearchResultsSchema, type ArtistSongsOrdering, type ArtistTrackListOriginInput, CriteriaCreationSchema, type CriteriaCreationValues, type CriteriaDetailed, CriteriaDetailedSchema, type CriteriaLineageRelWithoutAscendant, CriteriaLineageRelWithoutAscendantSchema, type CriteriaLineageRelWithoutDescendant, CriteriaLineageRelWithoutDescendantSchema, type CriteriaMinimum, CriteriaMinimumSchema, type CriteriaOverview, CriteriaOverviewSchema, type CriteriaPlaylistDetailed, CriteriaPlaylistDetailedSchema, type CriteriaPlaylistMinimum, CriteriaPlaylistMinimumSchema, type CriteriaPlaylistSimple, CriteriaPlaylistSimpleSchema, type CriteriaSimple, CriteriaSimpleSchema, CriteriaUpdateSchema, type CriteriaUpdateValues, FORM_RATING_NULL_VALUE, FUZZY_MIN_SIMILARITY, type GenreCatalogueCounts, GenreCatalogueCountsSchema, GenreCountsSchema, type GenreCoverage, GenreCoverageSchema, type GenreMusicCounts, type GenreMusicSelection, type GenrePlaylistSummary, GenrePlaylistSummarySchema, type GenrePlaylistTracksPage, GenrePlaylistUuid, type GenreSearchParams, type GenreSearchResult, GenreSearchResultSchema, GenreSearchResultsSchema, type GenreSearchTreeName, GenreSearchTreeNameSchema, GenreUuid, type GenreViewMode, MbArtistDetailedSchema, MbRecordingDetailedSchema, type MusicbrainzArtistDetailed, type MusicbrainzRecordingDetailed, NO_VIDEO_LABEL, type NameIndex, type PlayArtistOptions, type PlayGenrePlaylistOptions, type ReferenceGenreDetailed, ReferenceGenreDetailedSchema, type ReferenceGenrePlaylist, ReferenceGenrePlaylistSchema, type RegionGenreLexiconEntry, RegionGenreLexiconEntrySchema, RegionGenreLexiconSchema, type RenderArtistLink, type RenderSongLink, type ReparentCandidate, SEARCH_DEBOUNCE_MS, SEARCH_QUERY_MIN_LENGTH, type SongDetailed, SongDetailedSchema, type SongHistoryEntry, SongHistoryEntrySchema, SongHistorySchema, type SongSearchGenreFilter, type SongSearchParams, type SongSearchResult, SongSearchResultSchema, SongSearchResultsSchema, SubgenreCountsSchema, type SubgenreScope, SubgenreScopeSchema, type TrackBase, TrackBaseSchema, TrackList, TrackListFromArtist, TrackListFromCriteriaPlaylist, TrackListFromTrack, TrackListOrigin, TrackListOriginFromArtist, TrackListOriginFromCriteriaPlaylist, TrackListOriginFromGenreCatalogue, TrackListOriginFromTrack, TrackListOriginType, TrackListProvider, TrackListSidebarVisibilityProvider, type TrackMinimum, TrackMinimumSchema, type TrackPlaylistRel, type UseArtistResult, type UseArtistSearchResult, type UseGenreRemoteSearchOptions, type UseGenreRemoteSearchResult, type UseGenreSearchOptions, type UseGenreSearchResult, type UseGenreTreeViewStateOptions, type UseGenreTreeViewStateResult, type UseRemoteSearchOptions, type UseRemoteSearchResult, type UseSearchQueryStateOptions, type UseSearchQueryStateResult, type UseSongHistoryResult, type UseSongResult, type UseSongSearchResult, type UseVisibleGenrePlaylistsOptions, type UuidResource, UuidResourceSchema, YOUTUBE_UNPLAYABLE_REASON_LABELS, YoutubeAvailabilitySchema, type YoutubeUnplayableReason, artistEndpoints, artistQueryKeys, capitalizeFirstLetter, createNameIndex, defaultGenreMusicSelection, editGenreSongPages, foldSearchText, formatTime, genreEndpoints, genreMusicCount, genreMusicQueryParams, genreMusicSelectionKey, genrePlaylistEndpoints, genrePlaylistQueryKeys, genrePlaylistTrackCount, genreQueryKeys, genreSearchQueryKeys, genreUpdateMutationKey, getGenrePlaylistsGroupedByRoot, getReparentCandidates, hasMainstreamPopRoot, isSong, isSongSearchResultPlayable, libraryEndpoints, libraryQueryKeys, makeTrackPlaylistRelPageSchema, makeTrackPlaylistRelSchema, musicBrainzRecordingUrl,
|
|
5006
|
+
export { ARTIST_LINK_KINDS, type AlbumMinimum, AlbumMinimumSchema, type ArtistAlbum, type ArtistDetailed, ArtistDetailedSchema, type ArtistGenreCount, ArtistGenreCountSchema, type ArtistGenreProjection, type ArtistImage, ArtistImageSchema, type ArtistLink, type ArtistMembership, type ArtistMinimum, ArtistMinimumSchema, ArtistNames, type ArtistSearchResult, ArtistSearchResultSchema, ArtistSearchResultsSchema, type ArtistSongsOrdering, type ArtistTrackListOriginInput, CriteriaCreationSchema, type CriteriaCreationValues, type CriteriaDetailed, CriteriaDetailedSchema, type CriteriaLineageRelWithoutAscendant, CriteriaLineageRelWithoutAscendantSchema, type CriteriaLineageRelWithoutDescendant, CriteriaLineageRelWithoutDescendantSchema, type CriteriaMinimum, CriteriaMinimumSchema, type CriteriaOverview, CriteriaOverviewSchema, type CriteriaPlaylistDetailed, CriteriaPlaylistDetailedSchema, type CriteriaPlaylistMinimum, CriteriaPlaylistMinimumSchema, type CriteriaPlaylistSimple, CriteriaPlaylistSimpleSchema, type CriteriaSimple, CriteriaSimpleSchema, CriteriaUpdateSchema, type CriteriaUpdateValues, FORM_RATING_NULL_VALUE, FUZZY_MIN_SIMILARITY, type GenreCatalogueCounts, GenreCatalogueCountsSchema, GenreCountsSchema, type GenreCoverage, GenreCoverageSchema, type GenreMusicCounts, type GenreMusicSelection, type GenrePlaylistSummary, GenrePlaylistSummarySchema, type GenrePlaylistTracksPage, GenrePlaylistUuid, type GenreSearchParams, type GenreSearchResult, GenreSearchResultSchema, GenreSearchResultsSchema, type GenreSearchTreeName, GenreSearchTreeNameSchema, GenreUuid, type GenreViewMode, MbArtistDetailedSchema, MbRecordingDetailedSchema, type MusicbrainzArtistDetailed, type MusicbrainzRecordingDetailed, NO_VIDEO_LABEL, type NameIndex, type PlayArtistOptions, type PlayGenrePlaylistOptions, type ReferenceGenreDetailed, ReferenceGenreDetailedSchema, type ReferenceGenrePlaylist, ReferenceGenrePlaylistSchema, type RegionGenreLexiconEntry, RegionGenreLexiconEntrySchema, RegionGenreLexiconSchema, type RenderArtistLink, type RenderSongLink, type ReparentCandidate, SEARCH_DEBOUNCE_MS, SEARCH_QUERY_MIN_LENGTH, type SongDetailed, SongDetailedSchema, type SongHistoryEntry, SongHistoryEntrySchema, SongHistorySchema, type SongSearchGenreFilter, type SongSearchParams, type SongSearchResult, SongSearchResultSchema, SongSearchResultsSchema, SubgenreCountsSchema, type SubgenreScope, SubgenreScopeSchema, type TrackBase, TrackBaseSchema, TrackList, TrackListFromArtist, TrackListFromCriteriaPlaylist, TrackListFromTrack, TrackListOrigin, TrackListOriginFromArtist, TrackListOriginFromCriteriaPlaylist, TrackListOriginFromGenreCatalogue, TrackListOriginFromTrack, TrackListOriginType, TrackListProvider, TrackListSidebarVisibilityProvider, type TrackMinimum, TrackMinimumSchema, type TrackPlaylistRel, TracksFailureAlreadyReportedError, type UseArtistResult, type UseArtistSearchResult, type UseGenreRemoteSearchOptions, type UseGenreRemoteSearchResult, type UseGenreSearchOptions, type UseGenreSearchResult, type UseGenreTreeViewStateOptions, type UseGenreTreeViewStateResult, type UseRemoteSearchOptions, type UseRemoteSearchResult, type UseSearchQueryStateOptions, type UseSearchQueryStateResult, type UseSongHistoryResult, type UseSongResult, type UseSongSearchResult, type UseVisibleGenrePlaylistsOptions, type UuidResource, UuidResourceSchema, YOUTUBE_UNPLAYABLE_REASON_LABELS, YoutubeAvailabilitySchema, type YoutubeUnplayableReason, artistEndpoints, artistQueryKeys, capitalizeFirstLetter, createNameIndex, defaultGenreMusicSelection, editGenreSongPages, foldSearchText, formatTime, genreEndpoints, genreMusicCount, genreMusicQueryParams, genreMusicSelectionKey, genrePlaylistEndpoints, genrePlaylistQueryKeys, genrePlaylistTrackCount, genreQueryKeys, genreSearchQueryKeys, genreUpdateMutationKey, getGenrePlaylistsGroupedByRoot, getReparentCandidates, hasMainstreamPopRoot, isSong, isSongSearchResultPlayable, libraryEndpoints, libraryQueryKeys, makeTrackPlaylistRelPageSchema, makeTrackPlaylistRelSchema, musicBrainzRecordingUrl, projectGenrePlaylistsForArtist, rankByName, rankNameIndex, searchGenrePlaylistsByName, songUnplayableReason, trigramSimilarity, useArtist, useArtistGenreCounts, useArtistSearch, useCreateGenre, useDeleteGenre, useFetchGenre, useFetchGenreDetail, useFetchGenreOverview, useFetchGenrePlaylist, useGenreByWikidataId, useGenreRemoteSearch, useGenreSearch, useGenreTreeViewState, useInvalidateAllGenrePlaylistQueries, useListFullGenrePlaylists, useListGenrePlaylists, useListGenres, useListTracks, usePrefetchGenreOverview, useRegionGenreLexicon, useRemoteSearch, useSearchQueryState, useSong, useSongHistory, useSongSearch, useTrackList, useTrackListSidebarVisibility, useUpdateGenre, useVisibleGenrePlaylists };
|
package/dist/genre-tree/index.js
CHANGED
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
TrackListProvider,
|
|
59
59
|
TrackListSidebarVisibilityProvider,
|
|
60
60
|
TrackMinimumSchema,
|
|
61
|
+
TracksFailureAlreadyReportedError,
|
|
61
62
|
UuidResourceSchema,
|
|
62
63
|
YOUTUBE_UNPLAYABLE_REASON_LABELS,
|
|
63
64
|
YoutubeAvailabilitySchema,
|
|
@@ -89,7 +90,7 @@ import {
|
|
|
89
90
|
makeTrackPlaylistRelPageSchema,
|
|
90
91
|
makeTrackPlaylistRelSchema,
|
|
91
92
|
musicBrainzRecordingUrl,
|
|
92
|
-
|
|
93
|
+
projectGenrePlaylistsForArtist,
|
|
93
94
|
rankByName,
|
|
94
95
|
rankNameIndex,
|
|
95
96
|
searchGenrePlaylistsByName,
|
|
@@ -124,9 +125,9 @@ import {
|
|
|
124
125
|
useTrackListSidebarVisibility,
|
|
125
126
|
useUpdateGenre,
|
|
126
127
|
useVisibleGenrePlaylists
|
|
127
|
-
} from "../chunk-
|
|
128
|
-
import "../chunk-
|
|
129
|
-
import "../chunk-
|
|
128
|
+
} from "../chunk-D5UFJF4K.js";
|
|
129
|
+
import "../chunk-AYAKFCBP.js";
|
|
130
|
+
import "../chunk-WL2TKQVN.js";
|
|
130
131
|
import "../chunk-4MEK3CNF.js";
|
|
131
132
|
import "../chunk-MAKY4YBN.js";
|
|
132
133
|
import "../chunk-W4QTTNNA.js";
|
|
@@ -196,6 +197,7 @@ export {
|
|
|
196
197
|
TrackListProvider,
|
|
197
198
|
TrackListSidebarVisibilityProvider,
|
|
198
199
|
TrackMinimumSchema,
|
|
200
|
+
TracksFailureAlreadyReportedError,
|
|
199
201
|
UuidResourceSchema,
|
|
200
202
|
YOUTUBE_UNPLAYABLE_REASON_LABELS,
|
|
201
203
|
YoutubeAvailabilitySchema,
|
|
@@ -227,7 +229,7 @@ export {
|
|
|
227
229
|
makeTrackPlaylistRelPageSchema,
|
|
228
230
|
makeTrackPlaylistRelSchema,
|
|
229
231
|
musicBrainzRecordingUrl,
|
|
230
|
-
|
|
232
|
+
projectGenrePlaylistsForArtist,
|
|
231
233
|
rankByName,
|
|
232
234
|
rankNameIndex,
|
|
233
235
|
searchGenrePlaylistsByName,
|
package/dist/index.cjs
CHANGED
|
@@ -108,6 +108,7 @@ __export(src_exports, {
|
|
|
108
108
|
TrackListSidebarVisibilityProvider: () => TrackListSidebarVisibilityProvider,
|
|
109
109
|
TrackMinimumSchema: () => TrackMinimumSchema,
|
|
110
110
|
TrackNounProvider: () => TrackNounProvider,
|
|
111
|
+
TracksFailureAlreadyReportedError: () => TracksFailureAlreadyReportedError,
|
|
111
112
|
UuidResourceSchema: () => UuidResourceSchema,
|
|
112
113
|
YOUTUBE_UNPLAYABLE_REASON_LABELS: () => YOUTUBE_UNPLAYABLE_REASON_LABELS,
|
|
113
114
|
YoutubeAvailabilitySchema: () => YoutubeAvailabilitySchema,
|
|
@@ -155,7 +156,7 @@ __export(src_exports, {
|
|
|
155
156
|
makeTrackPlaylistRelSchema: () => makeTrackPlaylistRelSchema,
|
|
156
157
|
musicBrainzRecordingUrl: () => musicBrainzRecordingUrl,
|
|
157
158
|
parseWithLog: () => parseWithLog,
|
|
158
|
-
|
|
159
|
+
projectGenrePlaylistsForArtist: () => projectGenrePlaylistsForArtist,
|
|
159
160
|
queryClient: () => queryClient,
|
|
160
161
|
rankByName: () => rankByName,
|
|
161
162
|
rankNameIndex: () => rankNameIndex,
|
|
@@ -547,6 +548,12 @@ async function createAppErrorFromResult(result, backendBaseUrl) {
|
|
|
547
548
|
} else {
|
|
548
549
|
return createAppErrorFromErrorCode("SER5000" /* SERVICE_INTERNAL_ERROR */);
|
|
549
550
|
}
|
|
551
|
+
} else if (result.status === 502 || result.status === 503 || result.status === 504) {
|
|
552
|
+
if (isBackendError) {
|
|
553
|
+
return createAppErrorFromErrorCode("BAC2000" /* BACKEND_UNAVAILABLE */);
|
|
554
|
+
} else {
|
|
555
|
+
return createAppErrorFromErrorCode("SER5000" /* SERVICE_INTERNAL_ERROR */);
|
|
556
|
+
}
|
|
550
557
|
}
|
|
551
558
|
return createAppErrorFromErrorCode("CLI5001" /* CLIENT_UNKNOWN */);
|
|
552
559
|
}
|
|
@@ -3229,38 +3236,41 @@ var import_react21 = require("react");
|
|
|
3229
3236
|
// src/genre-tree/useVisibleGenrePlaylists.ts
|
|
3230
3237
|
var import_react20 = require("react");
|
|
3231
3238
|
|
|
3232
|
-
// src/genre-tree/lib/
|
|
3233
|
-
var
|
|
3234
|
-
var
|
|
3235
|
-
var
|
|
3239
|
+
// src/genre-tree/lib/project-genre-playlists-for-artist.ts
|
|
3240
|
+
var ZERO_SCOPED = { genreOnlyTracksCount: 0, genreAndSubgenresTracksCount: { canonical: 0, regional: 0, all: 0 } };
|
|
3241
|
+
var ZERO_ALL = { genreOnlyTracksCount: 0, genreAndSubgenresTracksCount: { all: 0 } };
|
|
3242
|
+
var ZERO_SCOPED_CATALOGUE = GenreCatalogueCountsSchema.parse(ZERO_SCOPED);
|
|
3243
|
+
var ZERO_ALL_CATALOGUE = GenreCatalogueCountsSchema.parse(ZERO_ALL);
|
|
3244
|
+
var projectGenrePlaylistsForArtist = (playlists, counts) => {
|
|
3236
3245
|
const countByPlaylist = new Map(counts.map((count) => [count.genrePlaylist, count]));
|
|
3237
|
-
const
|
|
3238
|
-
|
|
3239
|
-
const isPopRoot = playlist.parent === null && playlist.name === POP_ROOT_NAME;
|
|
3240
|
-
if (isPopRoot || (countByPlaylist.get(playlist.uuid)?.catalogue.genreAndSubgenresTracksCount.all ?? 0) > 0) kept.add(playlist.uuid);
|
|
3241
|
-
}
|
|
3242
|
-
const coreElectronicUuids = new Set(
|
|
3243
|
-
playlists.filter((playlist) => playlist.name === CORE_ELECTRONIC_NAME && kept.has(playlist.uuid)).map((p) => p.uuid)
|
|
3246
|
+
const focusUuids = new Set(
|
|
3247
|
+
counts.filter((count) => count.catalogue.genreAndSubgenresTracksCount.all > 0).map((count) => count.genrePlaylist)
|
|
3244
3248
|
);
|
|
3245
|
-
|
|
3246
|
-
if (playlist.parent && coreElectronicUuids.has(playlist.parent.uuid)) kept.add(playlist.uuid);
|
|
3247
|
-
}
|
|
3248
|
-
return playlists.filter((playlist) => kept.has(playlist.uuid)).map((playlist) => {
|
|
3249
|
+
const genrePlaylists = playlists.map((playlist) => {
|
|
3249
3250
|
const count = countByPlaylist.get(playlist.uuid);
|
|
3250
|
-
|
|
3251
|
+
if (count) {
|
|
3252
|
+
return {
|
|
3253
|
+
...playlist,
|
|
3254
|
+
genreOnlyTracksCount: count.genreOnlyTracksCount,
|
|
3255
|
+
genreAndSubgenresTracksCount: count.genreAndSubgenresTracksCount,
|
|
3256
|
+
catalogue: count.catalogue,
|
|
3257
|
+
tracksCount: genreMusicCount(count),
|
|
3258
|
+
// Artist view totals are not served.
|
|
3259
|
+
viewsCount: void 0
|
|
3260
|
+
};
|
|
3261
|
+
}
|
|
3251
3262
|
const scopes = playlist.genreAndSubgenresTracksCount;
|
|
3252
|
-
if (!scopes) throw new Error(
|
|
3253
|
-
const
|
|
3263
|
+
if (!scopes) throw new Error(`Artist projections require a reference genre summary (genre playlist ${playlist.uuid})`);
|
|
3264
|
+
const isScoped = "canonical" in scopes;
|
|
3254
3265
|
return {
|
|
3255
3266
|
...playlist,
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
tracksCount: count ? genreMusicCount(count) : 0,
|
|
3260
|
-
// Artist view totals are not served.
|
|
3267
|
+
...isScoped ? ZERO_SCOPED : ZERO_ALL,
|
|
3268
|
+
catalogue: isScoped ? ZERO_SCOPED_CATALOGUE : ZERO_ALL_CATALOGUE,
|
|
3269
|
+
tracksCount: 0,
|
|
3261
3270
|
viewsCount: void 0
|
|
3262
3271
|
};
|
|
3263
3272
|
});
|
|
3273
|
+
return { genrePlaylists, focusUuids };
|
|
3264
3274
|
};
|
|
3265
3275
|
|
|
3266
3276
|
// src/genre-tree/useVisibleGenrePlaylists.ts
|
|
@@ -3269,9 +3279,9 @@ function useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid = null
|
|
|
3269
3279
|
const counts = useArtistGenreCounts(artistUuid, getBackendBaseUrl);
|
|
3270
3280
|
const artistCounts = artistUuid !== null ? counts.data : void 0;
|
|
3271
3281
|
const isCountsLoading = artistUuid !== null && (counts.isPending || counts.isPlaceholderData);
|
|
3272
|
-
const
|
|
3273
|
-
if (!tree) return [];
|
|
3274
|
-
return artistCounts ?
|
|
3282
|
+
const projection = (0, import_react20.useMemo)(() => {
|
|
3283
|
+
if (!tree) return { genrePlaylists: [], focusUuids: void 0 };
|
|
3284
|
+
return artistCounts ? projectGenrePlaylistsForArtist(tree, artistCounts) : { genrePlaylists: tree, focusUuids: void 0 };
|
|
3275
3285
|
}, [tree, artistCounts]);
|
|
3276
3286
|
return {
|
|
3277
3287
|
isLoading: isTreePending,
|
|
@@ -3279,7 +3289,8 @@ function useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid = null
|
|
|
3279
3289
|
isError: isTreeError && !tree,
|
|
3280
3290
|
refetch,
|
|
3281
3291
|
isFetching: isCountsLoading || !isTreePending && isTreeFetching,
|
|
3282
|
-
genrePlaylists
|
|
3292
|
+
genrePlaylists: projection.genrePlaylists,
|
|
3293
|
+
focusUuids: projection.focusUuids
|
|
3283
3294
|
};
|
|
3284
3295
|
}
|
|
3285
3296
|
|
|
@@ -3316,7 +3327,7 @@ function useGenreTreeViewState({
|
|
|
3316
3327
|
},
|
|
3317
3328
|
[isSelectionControlled, onSelectedGenreUuidChange]
|
|
3318
3329
|
);
|
|
3319
|
-
const { isLoading, isError, refetch, isFetching, genrePlaylists } = useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid });
|
|
3330
|
+
const { isLoading, isError, refetch, isFetching, genrePlaylists, focusUuids } = useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid });
|
|
3320
3331
|
const genrePlaylistByNodeId = (0, import_react21.useMemo)(() => new Map(genrePlaylists.map((gp) => [gp.uuid, gp])), [genrePlaylists]);
|
|
3321
3332
|
const selectedGenrePlaylist = (0, import_react21.useMemo)(
|
|
3322
3333
|
() => genrePlaylists.find((gp) => gp.criteria?.uuid === selectedGenreUuid),
|
|
@@ -3382,6 +3393,7 @@ function useGenreTreeViewState({
|
|
|
3382
3393
|
refetch: () => void refetch(),
|
|
3383
3394
|
isFetching,
|
|
3384
3395
|
genrePlaylists,
|
|
3396
|
+
focusUuids,
|
|
3385
3397
|
genrePlaylistByNodeId,
|
|
3386
3398
|
visibleGenrePlaylists,
|
|
3387
3399
|
groupedGenrePlaylistsByRoot,
|
|
@@ -3576,6 +3588,12 @@ var AUTO_SKIP_DELAY_MS = 1e3;
|
|
|
3576
3588
|
function isTrackPlayable(track, runtimeUnplayableTrackIds, hasPlaybackFailure) {
|
|
3577
3589
|
return !runtimeUnplayableTrackIds.has(track.uuid) && (!isSong(track) || songUnplayableReason(track) === null && (!track.youtubeVideo || !hasPlaybackFailure(track.youtubeVideo.id)));
|
|
3578
3590
|
}
|
|
3591
|
+
var TracksFailureAlreadyReportedError = class extends Error {
|
|
3592
|
+
constructor() {
|
|
3593
|
+
super("Genre playlist tracks request failed; the failure was already reported globally");
|
|
3594
|
+
this.name = "TracksFailureAlreadyReportedError";
|
|
3595
|
+
}
|
|
3596
|
+
};
|
|
3579
3597
|
function useListTracks(scope, getBackendBaseUrl, schema, listEndpoint, listQueryKey, page = 1, pageSize = 50) {
|
|
3580
3598
|
const { session, sessionRestored } = useSession();
|
|
3581
3599
|
return usePlaybackQuery({
|
|
@@ -3644,6 +3662,7 @@ function TrackListProvider({
|
|
|
3644
3662
|
if (scope === "me" && (selection || artistUuid)) throw new Error("Genre selections require reference scope");
|
|
3645
3663
|
const params = { page, pageSize: TRACKS_PAGE_SIZE, ...from && { from }, ...genreMusicQueryParams(selection), ...artistUuid && { artist: artistUuid } };
|
|
3646
3664
|
const response = await (page === 1 ? fetchLatest : fetchBound)(endpoint, true, scope === "me", {}, params, false, !!from);
|
|
3665
|
+
if (response === null && !from) throw new TracksFailureAlreadyReportedError();
|
|
3647
3666
|
const parsed = parseWithLog(pageSchema, response, "fetchGenrePlaylistTracksPage");
|
|
3648
3667
|
return {
|
|
3649
3668
|
tracks: parsed.results.map((rel) => rel.track),
|
|
@@ -4215,6 +4234,7 @@ function editGenreSongPages(data, edit) {
|
|
|
4215
4234
|
TrackListSidebarVisibilityProvider,
|
|
4216
4235
|
TrackMinimumSchema,
|
|
4217
4236
|
TrackNounProvider,
|
|
4237
|
+
TracksFailureAlreadyReportedError,
|
|
4218
4238
|
UuidResourceSchema,
|
|
4219
4239
|
YOUTUBE_UNPLAYABLE_REASON_LABELS,
|
|
4220
4240
|
YoutubeAvailabilitySchema,
|
|
@@ -4262,7 +4282,7 @@ function editGenreSongPages(data, edit) {
|
|
|
4262
4282
|
makeTrackPlaylistRelSchema,
|
|
4263
4283
|
musicBrainzRecordingUrl,
|
|
4264
4284
|
parseWithLog,
|
|
4265
|
-
|
|
4285
|
+
projectGenrePlaylistsForArtist,
|
|
4266
4286
|
queryClient,
|
|
4267
4287
|
rankByName,
|
|
4268
4288
|
rankNameIndex,
|