@behindthemusictree/app-kit 41.0.0 → 42.0.1
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/chunk-RGHDVBEY.js +26 -0
- package/dist/chunk-RGHDVBEY.js.map +1 -0
- package/dist/{chunk-4E3YMYDH.js → chunk-ZAS53EAW.js} +119 -107
- package/dist/chunk-ZAS53EAW.js.map +1 -0
- package/dist/genre-tree/index.cjs +135 -109
- package/dist/genre-tree/index.cjs.map +1 -1
- package/dist/genre-tree/index.d.ts +38 -6
- package/dist/genre-tree/index.js +13 -3
- package/dist/genre-tree/testing.cjs +11 -0
- package/dist/genre-tree/testing.cjs.map +1 -1
- package/dist/genre-tree/testing.d.ts +1 -1
- package/dist/genre-tree/testing.js +1 -1
- package/dist/ids-FmUQ8DVM.d.ts +18 -0
- package/dist/index.cjs +133 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -3
- package/package.json +1 -1
- package/dist/chunk-4E3YMYDH.js.map +0 -1
- package/dist/chunk-X2QEQR6H.js +0 -15
- package/dist/chunk-X2QEQR6H.js.map +0 -1
- package/dist/ids-D7EDBsbJ.d.ts +0 -10
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/genre-tree/schemas/ids.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var GenreUuidSchema = z.string().uuid().brand();
|
|
4
|
+
var GenrePlaylistUuidSchema = z.string().uuid().brand();
|
|
5
|
+
var ArtistUuidSchema = z.string().uuid().brand();
|
|
6
|
+
var SongUuidSchema = z.string().uuid().brand();
|
|
7
|
+
function toId(schema) {
|
|
8
|
+
return (value) => {
|
|
9
|
+
const parsed = schema.safeParse(value);
|
|
10
|
+
return parsed.success ? parsed.data : null;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
var toGenreUuid = toId(GenreUuidSchema);
|
|
14
|
+
var toArtistUuid = toId(ArtistUuidSchema);
|
|
15
|
+
var toSongUuid = toId(SongUuidSchema);
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
GenreUuidSchema,
|
|
19
|
+
GenrePlaylistUuidSchema,
|
|
20
|
+
ArtistUuidSchema,
|
|
21
|
+
SongUuidSchema,
|
|
22
|
+
toGenreUuid,
|
|
23
|
+
toArtistUuid,
|
|
24
|
+
toSongUuid
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=chunk-RGHDVBEY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/genre-tree/schemas/ids.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// A genre (criteria) and its genre playlist are 1:1 but live in distinct UUID spaces: `genres/{uuid}/`\n// takes the former, `genre-playlists/{uuid}/` the latter. Branding makes mixing them a compile error.\nexport const GenreUuidSchema = z.string().uuid().brand<\"GenreUuid\">();\nexport const GenrePlaylistUuidSchema = z.string().uuid().brand<\"GenrePlaylistUuid\">();\n\nexport const ArtistUuidSchema = z.string().uuid().brand<\"ArtistUuid\">();\nexport const SongUuidSchema = z.string().uuid().brand<\"SongUuid\">();\n\nexport type GenreUuid = z.infer<typeof GenreUuidSchema>;\nexport type GenrePlaylistUuid = z.infer<typeof GenrePlaylistUuidSchema>;\nexport type ArtistUuid = z.infer<typeof ArtistUuidSchema>;\nexport type SongUuid = z.infer<typeof SongUuidSchema>;\n\nfunction toId<S extends z.ZodType<string>>(schema: S) {\n return (value: string | null): z.infer<S> | null => {\n const parsed = schema.safeParse(value);\n return parsed.success ? parsed.data : null;\n };\n}\n\n/** The id as a `GenreUuid`, or null when it is absent or malformed (e.g. a raw URL value). */\nexport const toGenreUuid = toId(GenreUuidSchema);\n\n/** The id as an `ArtistUuid`, or null when it is absent or malformed (e.g. a raw URL value). */\nexport const toArtistUuid = toId(ArtistUuidSchema);\n\n/** The id as a `SongUuid`, or null when it is absent or malformed (e.g. a raw URL value). */\nexport const toSongUuid = toId(SongUuidSchema);\n"],"mappings":";AAAA,SAAS,SAAS;AAIX,IAAM,kBAAkB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAmB;AAC7D,IAAM,0BAA0B,EAAE,OAAO,EAAE,KAAK,EAAE,MAA2B;AAE7E,IAAM,mBAAmB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAoB;AAC/D,IAAM,iBAAiB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAkB;AAOlE,SAAS,KAAkC,QAAW;AACpD,SAAO,CAAC,UAA4C;AAClD,UAAM,SAAS,OAAO,UAAU,KAAK;AACrC,WAAO,OAAO,UAAU,OAAO,OAAO;AAAA,EACxC;AACF;AAGO,IAAM,cAAc,KAAK,eAAe;AAGxC,IAAM,eAAe,KAAK,gBAAgB;AAG1C,IAAM,aAAa,KAAK,cAAc;","names":[]}
|
|
@@ -24,8 +24,10 @@ import {
|
|
|
24
24
|
import {
|
|
25
25
|
GenrePlaylistUuidSchema,
|
|
26
26
|
GenreUuidSchema,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
toArtistUuid,
|
|
28
|
+
toGenreUuid,
|
|
29
|
+
toSongUuid
|
|
30
|
+
} from "./chunk-RGHDVBEY.js";
|
|
29
31
|
|
|
30
32
|
// src/genre-tree/useGenre.ts
|
|
31
33
|
import { z as z20 } from "zod";
|
|
@@ -657,9 +659,6 @@ function useDeleteGenre(scope, getBackendBaseUrl) {
|
|
|
657
659
|
});
|
|
658
660
|
}
|
|
659
661
|
|
|
660
|
-
// src/genre-tree/useArtist.ts
|
|
661
|
-
import { z as z22 } from "zod";
|
|
662
|
-
|
|
663
662
|
// src/genre-tree/schemas/artist-detailed.ts
|
|
664
663
|
import { z as z21 } from "zod";
|
|
665
664
|
var ArtistMembershipSchema = z21.object({
|
|
@@ -681,6 +680,15 @@ var ARTIST_LINK_KINDS = [
|
|
|
681
680
|
"social"
|
|
682
681
|
];
|
|
683
682
|
var ArtistImageSchema = CommonsImageSchema;
|
|
683
|
+
var ArtistOriginSchema = z21.object({
|
|
684
|
+
name: z21.string(),
|
|
685
|
+
kind: z21.string().nullable(),
|
|
686
|
+
source: z21.enum(["begin_area", "area"]),
|
|
687
|
+
wikidataId: z21.string().nullable(),
|
|
688
|
+
longitude: z21.number().nullable(),
|
|
689
|
+
latitude: z21.number().nullable(),
|
|
690
|
+
regionId: z21.string().nullable()
|
|
691
|
+
});
|
|
684
692
|
var ArtistDetailedSchema = z21.object({
|
|
685
693
|
uuid: z21.string().uuid(),
|
|
686
694
|
name: z21.string(),
|
|
@@ -704,7 +712,8 @@ var ArtistDetailedSchema = z21.object({
|
|
|
704
712
|
),
|
|
705
713
|
tracksCount: z21.number().int(),
|
|
706
714
|
playableTracksCount: z21.number().int(),
|
|
707
|
-
image: ArtistImageSchema.nullable()
|
|
715
|
+
image: ArtistImageSchema.nullable(),
|
|
716
|
+
origin: ArtistOriginSchema.nullable()
|
|
708
717
|
});
|
|
709
718
|
|
|
710
719
|
// src/genre-tree/api/artists/queryKeys.ts
|
|
@@ -725,10 +734,11 @@ var artistEndpoints = {
|
|
|
725
734
|
// src/genre-tree/useArtist.ts
|
|
726
735
|
function useArtist(uuid, getBackendBaseUrl) {
|
|
727
736
|
const { fetch } = useFetchWrapper(getBackendBaseUrl);
|
|
728
|
-
const
|
|
737
|
+
const id = toArtistUuid(uuid);
|
|
738
|
+
const isUuid = id !== null;
|
|
729
739
|
const { data, isPending, error } = useQueryWithParse({
|
|
730
|
-
queryKey: artistQueryKeys.detail(
|
|
731
|
-
queryFn: () => fetch(artistEndpoints.detail(
|
|
740
|
+
queryKey: artistQueryKeys.detail(id),
|
|
741
|
+
queryFn: () => fetch(artistEndpoints.detail(id), true, false),
|
|
732
742
|
schema: ArtistDetailedSchema,
|
|
733
743
|
enabled: isUuid,
|
|
734
744
|
retry: resourceRetry,
|
|
@@ -739,19 +749,19 @@ function useArtist(uuid, getBackendBaseUrl) {
|
|
|
739
749
|
}
|
|
740
750
|
|
|
741
751
|
// src/genre-tree/schemas/artist-search.ts
|
|
742
|
-
import { z as
|
|
743
|
-
var ArtistSearchResultSchema =
|
|
744
|
-
uuid:
|
|
745
|
-
name:
|
|
746
|
-
disambiguation:
|
|
747
|
-
type:
|
|
748
|
-
country:
|
|
749
|
-
beginYear:
|
|
750
|
-
endYear:
|
|
751
|
-
matchedAlias:
|
|
752
|
-
recordingCount:
|
|
752
|
+
import { z as z22 } from "zod";
|
|
753
|
+
var ArtistSearchResultSchema = z22.object({
|
|
754
|
+
uuid: z22.string().uuid(),
|
|
755
|
+
name: z22.string(),
|
|
756
|
+
disambiguation: z22.string().nullable(),
|
|
757
|
+
type: z22.enum(["person", "group", "orchestra", "choir", "character", "other"]).nullable(),
|
|
758
|
+
country: z22.string().nullable(),
|
|
759
|
+
beginYear: z22.number().int().nullable(),
|
|
760
|
+
endYear: z22.number().int().nullable(),
|
|
761
|
+
matchedAlias: z22.string().nullable(),
|
|
762
|
+
recordingCount: z22.number().int()
|
|
753
763
|
});
|
|
754
|
-
var ArtistSearchResultsSchema =
|
|
764
|
+
var ArtistSearchResultsSchema = z22.array(ArtistSearchResultSchema);
|
|
755
765
|
|
|
756
766
|
// src/genre-tree/useRemoteSearch.ts
|
|
757
767
|
import { keepPreviousData } from "@tanstack/react-query";
|
|
@@ -805,11 +815,8 @@ function useArtistSearch(getBackendBaseUrl, text) {
|
|
|
805
815
|
return { artists: results, isError, settled, pending };
|
|
806
816
|
}
|
|
807
817
|
|
|
808
|
-
// src/genre-tree/useSong.ts
|
|
809
|
-
import { z as z25 } from "zod";
|
|
810
|
-
|
|
811
818
|
// src/genre-tree/schemas/song/detailed.ts
|
|
812
|
-
import { z as
|
|
819
|
+
import { z as z23 } from "zod";
|
|
813
820
|
var YOUTUBE_UNPLAYABLE_REASON_LABELS = {
|
|
814
821
|
not_found: "Video unavailable",
|
|
815
822
|
not_embeddable: "Embedding disabled",
|
|
@@ -818,23 +825,23 @@ var YOUTUBE_UNPLAYABLE_REASON_LABELS = {
|
|
|
818
825
|
region_whitelisted: "Region restricted"
|
|
819
826
|
};
|
|
820
827
|
var YOUTUBE_UNPLAYABLE_REASONS = Object.keys(YOUTUBE_UNPLAYABLE_REASON_LABELS);
|
|
821
|
-
var YoutubeAvailabilitySchema =
|
|
822
|
-
status:
|
|
823
|
-
reason:
|
|
824
|
-
country:
|
|
828
|
+
var YoutubeAvailabilitySchema = z23.object({
|
|
829
|
+
status: z23.enum(["eligible", "blocked", "unknown"]),
|
|
830
|
+
reason: z23.string().nullable(),
|
|
831
|
+
country: z23.string().nullable()
|
|
825
832
|
});
|
|
826
833
|
var SongDetailedSchema = TrackBaseSchema.extend({
|
|
827
|
-
youtubeVideo:
|
|
828
|
-
id:
|
|
834
|
+
youtubeVideo: z23.object({
|
|
835
|
+
id: z23.string(),
|
|
829
836
|
availability: YoutubeAvailabilitySchema.optional(),
|
|
830
837
|
// null = playable
|
|
831
|
-
unplayableReason:
|
|
832
|
-
viewCount:
|
|
838
|
+
unplayableReason: z23.enum(YOUTUBE_UNPLAYABLE_REASONS).nullable(),
|
|
839
|
+
viewCount: z23.number().int().nullable().optional()
|
|
833
840
|
}).nullable(),
|
|
834
841
|
// null for hand-made/admin songs
|
|
835
|
-
musicbrainzRecordingId:
|
|
836
|
-
firstReleaseYear:
|
|
837
|
-
essentialGenres:
|
|
842
|
+
musicbrainzRecordingId: z23.string().uuid().nullable(),
|
|
843
|
+
firstReleaseYear: z23.number().int().nullable().optional(),
|
|
844
|
+
essentialGenres: z23.array(CriteriaMinimumSchema).optional()
|
|
838
845
|
});
|
|
839
846
|
var NO_VIDEO_LABEL = "No video available";
|
|
840
847
|
function isSong(track) {
|
|
@@ -852,11 +859,12 @@ function musicBrainzRecordingUrl(song) {
|
|
|
852
859
|
|
|
853
860
|
// src/genre-tree/useSong.ts
|
|
854
861
|
function useSong(uuid, getBackendBaseUrl) {
|
|
855
|
-
const
|
|
862
|
+
const id = toSongUuid(uuid);
|
|
863
|
+
const isUuid = id !== null;
|
|
856
864
|
const { data, isPending, error } = usePlaybackQuery({
|
|
857
865
|
getBackendBaseUrl,
|
|
858
|
-
queryKey: libraryQueryKeys.reference.songs.detail(
|
|
859
|
-
queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.detail(
|
|
866
|
+
queryKey: libraryQueryKeys.reference.songs.detail(id),
|
|
867
|
+
queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.detail(id), true, false, { signal }),
|
|
860
868
|
schema: SongDetailedSchema,
|
|
861
869
|
enabled: isUuid,
|
|
862
870
|
retry: resourceRetry,
|
|
@@ -867,24 +875,25 @@ function useSong(uuid, getBackendBaseUrl) {
|
|
|
867
875
|
}
|
|
868
876
|
|
|
869
877
|
// src/genre-tree/schemas/song-history.ts
|
|
870
|
-
import { z as
|
|
871
|
-
var SongHistoryEntrySchema =
|
|
872
|
-
uuid:
|
|
873
|
-
action:
|
|
874
|
-
actorPseudo:
|
|
875
|
-
oldValue:
|
|
876
|
-
newValue:
|
|
877
|
-
createdOn:
|
|
878
|
+
import { z as z24 } from "zod";
|
|
879
|
+
var SongHistoryEntrySchema = z24.object({
|
|
880
|
+
uuid: z24.string().uuid(),
|
|
881
|
+
action: z24.string(),
|
|
882
|
+
actorPseudo: z24.string().nullable(),
|
|
883
|
+
oldValue: z24.string().nullable(),
|
|
884
|
+
newValue: z24.string().nullable(),
|
|
885
|
+
createdOn: z24.string()
|
|
878
886
|
});
|
|
879
|
-
var SongHistorySchema =
|
|
887
|
+
var SongHistorySchema = z24.array(SongHistoryEntrySchema);
|
|
880
888
|
|
|
881
889
|
// src/genre-tree/useSongHistory.ts
|
|
882
890
|
function useSongHistory(uuid, getBackendBaseUrl, enabled) {
|
|
883
|
-
const
|
|
891
|
+
const id = toSongUuid(uuid);
|
|
892
|
+
const active = enabled && id !== null;
|
|
884
893
|
const { data, isPending, error } = usePlaybackQuery({
|
|
885
894
|
getBackendBaseUrl,
|
|
886
|
-
queryKey: libraryQueryKeys.reference.songs.history(
|
|
887
|
-
queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.history(
|
|
895
|
+
queryKey: libraryQueryKeys.reference.songs.history(id),
|
|
896
|
+
queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.history(id), true, false, { signal }),
|
|
888
897
|
schema: SongHistorySchema,
|
|
889
898
|
enabled: active,
|
|
890
899
|
context: "useSongHistory"
|
|
@@ -896,20 +905,20 @@ function useSongHistory(uuid, getBackendBaseUrl, enabled) {
|
|
|
896
905
|
}
|
|
897
906
|
|
|
898
907
|
// src/genre-tree/schemas/song-search.ts
|
|
899
|
-
import { z as
|
|
900
|
-
var SongSearchResultSchema =
|
|
901
|
-
uuid:
|
|
902
|
-
title:
|
|
903
|
-
artists:
|
|
908
|
+
import { z as z25 } from "zod";
|
|
909
|
+
var SongSearchResultSchema = z25.object({
|
|
910
|
+
uuid: z25.string().uuid(),
|
|
911
|
+
title: z25.string(),
|
|
912
|
+
artists: z25.array(ArtistMinimumSchema),
|
|
904
913
|
// null for songs not yet linked to a genre.
|
|
905
914
|
genre: CriteriaMinimumSchema.nullable(),
|
|
906
|
-
youtubeVideo:
|
|
907
|
-
id:
|
|
908
|
-
unplayableReason:
|
|
915
|
+
youtubeVideo: z25.object({
|
|
916
|
+
id: z25.string(),
|
|
917
|
+
unplayableReason: z25.string().nullable()
|
|
909
918
|
}).nullable(),
|
|
910
|
-
firstReleaseYear:
|
|
919
|
+
firstReleaseYear: z25.number().int().nullable()
|
|
911
920
|
});
|
|
912
|
-
var SongSearchResultsSchema =
|
|
921
|
+
var SongSearchResultsSchema = z25.array(SongSearchResultSchema);
|
|
913
922
|
function isSongSearchResultPlayable(result) {
|
|
914
923
|
return result.youtubeVideo !== null && result.youtubeVideo.unplayableReason === null;
|
|
915
924
|
}
|
|
@@ -937,18 +946,18 @@ function useSongSearch(getBackendBaseUrl, text, options = {}) {
|
|
|
937
946
|
|
|
938
947
|
// src/genre-tree/useArtistGenreCounts.ts
|
|
939
948
|
import { keepPreviousData as keepPreviousData2 } from "@tanstack/react-query";
|
|
940
|
-
import { z as
|
|
949
|
+
import { z as z27 } from "zod";
|
|
941
950
|
|
|
942
951
|
// src/genre-tree/schemas/artist-genre-count.ts
|
|
943
|
-
import { z as
|
|
944
|
-
var ArtistGenreCountSchema =
|
|
952
|
+
import { z as z26 } from "zod";
|
|
953
|
+
var ArtistGenreCountSchema = z26.object({
|
|
945
954
|
...GenreCountsSchema.shape,
|
|
946
955
|
catalogue: GenreCatalogueCountsSchema,
|
|
947
956
|
genrePlaylist: GenrePlaylistUuidSchema,
|
|
948
957
|
/** Legacy catalogue count for the default selection. */
|
|
949
|
-
songsCount:
|
|
958
|
+
songsCount: z26.number().int().nonnegative(),
|
|
950
959
|
/** Legacy playlist count for the default selection. */
|
|
951
|
-
tracksCount:
|
|
960
|
+
tracksCount: z26.number().int().nonnegative()
|
|
952
961
|
}).superRefine((row, ctx) => {
|
|
953
962
|
const counts = GenreCatalogueCountsSchema.safeParse(row);
|
|
954
963
|
if (!counts.success) {
|
|
@@ -961,11 +970,12 @@ var ArtistGenreCountSchema = z28.object({
|
|
|
961
970
|
// src/genre-tree/useArtistGenreCounts.ts
|
|
962
971
|
function useArtistGenreCounts(artistUuid, getBackendBaseUrl) {
|
|
963
972
|
const { fetch } = useFetchWrapper(getBackendBaseUrl);
|
|
973
|
+
const id = toArtistUuid(artistUuid);
|
|
964
974
|
return useQueryWithParse({
|
|
965
|
-
queryKey: [...artistQueryKeys.genreCounts(getBackendBaseUrl(),
|
|
966
|
-
queryFn: () => fetch(artistEndpoints.genreCounts(
|
|
967
|
-
schema:
|
|
968
|
-
enabled:
|
|
975
|
+
queryKey: [...artistQueryKeys.genreCounts(getBackendBaseUrl(), id), "genreMusicV1"],
|
|
976
|
+
queryFn: () => fetch(artistEndpoints.genreCounts(id), true, false),
|
|
977
|
+
schema: z27.array(ArtistGenreCountSchema),
|
|
978
|
+
enabled: id !== null,
|
|
969
979
|
placeholderData: keepPreviousData2,
|
|
970
980
|
retry: resourceRetry,
|
|
971
981
|
context: "useArtistGenreCounts"
|
|
@@ -1124,32 +1134,32 @@ function useGenreSearch({
|
|
|
1124
1134
|
}
|
|
1125
1135
|
|
|
1126
1136
|
// src/genre-tree/schemas/genre-search.ts
|
|
1127
|
-
import { z as
|
|
1128
|
-
var GenreSearchTreeNameSchema =
|
|
1129
|
-
var GenreSearchResultSchema =
|
|
1137
|
+
import { z as z28 } from "zod";
|
|
1138
|
+
var GenreSearchTreeNameSchema = z28.enum(["canonical", "regional"]);
|
|
1139
|
+
var GenreSearchResultSchema = z28.object({
|
|
1130
1140
|
/** Criteria (genre) uuid. */
|
|
1131
1141
|
uuid: GenreUuidSchema,
|
|
1132
|
-
name:
|
|
1142
|
+
name: z28.string(),
|
|
1133
1143
|
/** Null for app-created genres, which the Wikidata-keyed region index does not reference. */
|
|
1134
|
-
wikidataId:
|
|
1135
|
-
treeName:
|
|
1144
|
+
wikidataId: z28.string().nullable(),
|
|
1145
|
+
treeName: z28.string(),
|
|
1136
1146
|
/** Null when the genre has no playlist in the tree, so it cannot be opened there. */
|
|
1137
1147
|
genrePlaylistUuid: GenrePlaylistUuidSchema.nullable(),
|
|
1138
|
-
root:
|
|
1139
|
-
isUmbrella:
|
|
1140
|
-
viewsCount:
|
|
1148
|
+
root: z28.object({ uuid: GenreUuidSchema, name: z28.string() }),
|
|
1149
|
+
isUmbrella: z28.boolean(),
|
|
1150
|
+
viewsCount: z28.number().int()
|
|
1141
1151
|
});
|
|
1142
|
-
var GenreSearchResultsSchema =
|
|
1143
|
-
var RegionGenreLexiconEntrySchema =
|
|
1144
|
-
wikidataId:
|
|
1152
|
+
var GenreSearchResultsSchema = z28.array(GenreSearchResultSchema);
|
|
1153
|
+
var RegionGenreLexiconEntrySchema = z28.object({
|
|
1154
|
+
wikidataId: z28.string(),
|
|
1145
1155
|
uuid: GenreUuidSchema,
|
|
1146
|
-
name:
|
|
1147
|
-
treeName:
|
|
1156
|
+
name: z28.string(),
|
|
1157
|
+
treeName: z28.string(),
|
|
1148
1158
|
genrePlaylistUuid: GenrePlaylistUuidSchema.nullable(),
|
|
1149
|
-
isUmbrella:
|
|
1150
|
-
viewsCount:
|
|
1159
|
+
isUmbrella: z28.boolean(),
|
|
1160
|
+
viewsCount: z28.number().int()
|
|
1151
1161
|
});
|
|
1152
|
-
var RegionGenreLexiconSchema =
|
|
1162
|
+
var RegionGenreLexiconSchema = z28.array(RegionGenreLexiconEntrySchema);
|
|
1153
1163
|
|
|
1154
1164
|
// src/genre-tree/useGenreRemoteSearch.ts
|
|
1155
1165
|
var DEFAULT_RESULT_LIMIT2 = 8;
|
|
@@ -1229,9 +1239,10 @@ var projectGenrePlaylistsForArtist = (playlists, counts) => {
|
|
|
1229
1239
|
// src/genre-tree/useVisibleGenrePlaylists.ts
|
|
1230
1240
|
function useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid = null }) {
|
|
1231
1241
|
const { data: tree, isPending: isTreePending, isFetching: isTreeFetching, isError: isTreeError, refetch } = useListFullGenrePlaylists(scope, getBackendBaseUrl);
|
|
1232
|
-
const
|
|
1233
|
-
const
|
|
1234
|
-
const
|
|
1242
|
+
const validArtistUuid = toArtistUuid(artistUuid);
|
|
1243
|
+
const counts = useArtistGenreCounts(validArtistUuid, getBackendBaseUrl);
|
|
1244
|
+
const artistCounts = validArtistUuid !== null ? counts.data : void 0;
|
|
1245
|
+
const isCountsLoading = validArtistUuid !== null && (counts.isPending || counts.isPlaceholderData);
|
|
1235
1246
|
const projection = useMemo2(() => {
|
|
1236
1247
|
if (!tree) return { genrePlaylists: [], focusUuids: void 0 };
|
|
1237
1248
|
return artistCounts ? projectGenrePlaylistsForArtist(tree, artistCounts) : { genrePlaylists: tree, focusUuids: void 0 };
|
|
@@ -1371,10 +1382,10 @@ function useGenreTreeViewState({
|
|
|
1371
1382
|
import { createContext as createContext2, useState as useState5, useContext as useContext2, useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo5, useRef as useRef3 } from "react";
|
|
1372
1383
|
|
|
1373
1384
|
// src/genre-tree/schemas/track-playlist-rel/without-playlist.ts
|
|
1374
|
-
import { z as
|
|
1375
|
-
var makeTrackPlaylistRelSchema = (trackSchema) =>
|
|
1385
|
+
import { z as z29 } from "zod";
|
|
1386
|
+
var makeTrackPlaylistRelSchema = (trackSchema) => z29.object({
|
|
1376
1387
|
track: trackSchema,
|
|
1377
|
-
position:
|
|
1388
|
+
position: z29.number().min(0)
|
|
1378
1389
|
});
|
|
1379
1390
|
var makeTrackPlaylistRelPageSchema = (trackSchema) => PaginatedResponseSchema(makeTrackPlaylistRelSchema(trackSchema));
|
|
1380
1391
|
|
|
@@ -2013,24 +2024,24 @@ function ArtistNames({
|
|
|
2013
2024
|
}
|
|
2014
2025
|
|
|
2015
2026
|
// src/genre-tree/schemas/mb-artist.ts
|
|
2016
|
-
import { z as
|
|
2017
|
-
var MbArtistDetailedSchema =
|
|
2018
|
-
musicbrainzId:
|
|
2019
|
-
name:
|
|
2027
|
+
import { z as z30 } from "zod";
|
|
2028
|
+
var MbArtistDetailedSchema = z30.object({
|
|
2029
|
+
musicbrainzId: z30.string().uuid(),
|
|
2030
|
+
name: z30.string(),
|
|
2020
2031
|
musicbrainzLink: HttpUrlSchema
|
|
2021
2032
|
});
|
|
2022
2033
|
|
|
2023
2034
|
// src/genre-tree/schemas/mb-recording.ts
|
|
2024
|
-
import { z as
|
|
2025
|
-
var MbRecordingDetailedSchema =
|
|
2026
|
-
musicbrainzId:
|
|
2027
|
-
title:
|
|
2028
|
-
score:
|
|
2029
|
-
musicbrainzArtists:
|
|
2035
|
+
import { z as z31 } from "zod";
|
|
2036
|
+
var MbRecordingDetailedSchema = z31.object({
|
|
2037
|
+
musicbrainzId: z31.string().uuid(),
|
|
2038
|
+
title: z31.string(),
|
|
2039
|
+
score: z31.number(),
|
|
2040
|
+
musicbrainzArtists: z31.array(MbArtistDetailedSchema),
|
|
2030
2041
|
musicbrainzLink: HttpUrlSchema,
|
|
2031
|
-
durationInSec:
|
|
2032
|
-
durationStrInHourMinSec:
|
|
2033
|
-
releaseDate:
|
|
2042
|
+
durationInSec: z31.number().min(0).nullable().optional(),
|
|
2043
|
+
durationStrInHourMinSec: z31.string().nullable().optional(),
|
|
2044
|
+
releaseDate: z31.union([z31.string().datetime(), z31.string()]).transform((val) => {
|
|
2034
2045
|
try {
|
|
2035
2046
|
const date = new Date(val);
|
|
2036
2047
|
if (isNaN(date.getTime())) {
|
|
@@ -2152,6 +2163,7 @@ export {
|
|
|
2152
2163
|
useDeleteGenre,
|
|
2153
2164
|
ARTIST_LINK_KINDS,
|
|
2154
2165
|
ArtistImageSchema,
|
|
2166
|
+
ArtistOriginSchema,
|
|
2155
2167
|
ArtistDetailedSchema,
|
|
2156
2168
|
artistQueryKeys,
|
|
2157
2169
|
artistEndpoints,
|
|
@@ -2227,4 +2239,4 @@ export {
|
|
|
2227
2239
|
getReparentCandidates,
|
|
2228
2240
|
editGenreSongPages
|
|
2229
2241
|
};
|
|
2230
|
-
//# sourceMappingURL=chunk-
|
|
2242
|
+
//# sourceMappingURL=chunk-ZAS53EAW.js.map
|