@behindthemusictree/app-kit 40.1.0 → 41.0.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.
Files changed (45) hide show
  1. package/dist/{app-error-B8IoFBhD.d.ts → app-error-ZuIP62i5.d.ts} +3 -1
  2. package/dist/auth/index.cjs.map +1 -1
  3. package/dist/auth/index.d.ts +1 -1
  4. package/dist/auth/index.js +3 -3
  5. package/dist/{chunk-G5ULARLT.js → chunk-26YBFC2L.js} +11 -1
  6. package/dist/chunk-26YBFC2L.js.map +1 -0
  7. package/dist/{chunk-I7NXFXV3.js → chunk-2TJEWD56.js} +2 -2
  8. package/dist/{chunk-WL2TKQVN.js → chunk-3Y7RT7QF.js} +2 -2
  9. package/dist/{chunk-D5UFJF4K.js → chunk-4E3YMYDH.js} +185 -181
  10. package/dist/chunk-4E3YMYDH.js.map +1 -0
  11. package/dist/{chunk-4MEK3CNF.js → chunk-MPTID5ZR.js} +3 -1
  12. package/dist/{chunk-4MEK3CNF.js.map → chunk-MPTID5ZR.js.map} +1 -1
  13. package/dist/{chunk-MF7SJIEY.js → chunk-PZHKZHQY.js} +3 -3
  14. package/dist/{chunk-AYAKFCBP.js → chunk-WHJNRJRZ.js} +23 -15
  15. package/dist/chunk-WHJNRJRZ.js.map +1 -0
  16. package/dist/chunk-X2QEQR6H.js +15 -0
  17. package/dist/{chunk-JMFEWI53.js.map → chunk-X2QEQR6H.js.map} +1 -1
  18. package/dist/genre-tree/index.cjs +202 -177
  19. package/dist/genre-tree/index.cjs.map +1 -1
  20. package/dist/genre-tree/index.d.ts +42 -27
  21. package/dist/genre-tree/index.js +10 -6
  22. package/dist/genre-tree/testing.cjs.map +1 -1
  23. package/dist/genre-tree/testing.d.ts +1 -1
  24. package/dist/genre-tree/testing.js +1 -1
  25. package/dist/{ids-D8XCErUS.d.ts → ids-D7EDBsbJ.d.ts} +3 -1
  26. package/dist/index.cjs +206 -175
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +20 -10
  30. package/dist/popup/index.cjs.map +1 -1
  31. package/dist/popup/index.js +2 -2
  32. package/dist/transport/index.cjs +24 -2
  33. package/dist/transport/index.cjs.map +1 -1
  34. package/dist/transport/index.d.ts +3 -3
  35. package/dist/transport/index.js +11 -5
  36. package/dist/useFetchWrapper-H0lO4wFO.d.ts +41 -0
  37. package/package.json +1 -1
  38. package/dist/chunk-AYAKFCBP.js.map +0 -1
  39. package/dist/chunk-D5UFJF4K.js.map +0 -1
  40. package/dist/chunk-G5ULARLT.js.map +0 -1
  41. package/dist/chunk-JMFEWI53.js +0 -10
  42. package/dist/useFetchWrapper-C5lt5fQz.d.ts +0 -15
  43. /package/dist/{chunk-I7NXFXV3.js.map → chunk-2TJEWD56.js.map} +0 -0
  44. /package/dist/{chunk-WL2TKQVN.js.map → chunk-3Y7RT7QF.js.map} +0 -0
  45. /package/dist/{chunk-MF7SJIEY.js.map → chunk-PZHKZHQY.js.map} +0 -0
@@ -1,19 +1,20 @@
1
1
  import {
2
2
  PaginatedResponseSchema,
3
3
  parseWithLog,
4
+ resourceRetry,
5
+ toResourceResult,
4
6
  useFetchWrapper,
5
7
  usePlaybackFetch,
6
8
  usePlaybackQuery,
7
9
  useQueryWithParse,
8
10
  useValidatedMutation
9
- } from "./chunk-AYAKFCBP.js";
11
+ } from "./chunk-WHJNRJRZ.js";
10
12
  import {
11
13
  useSession
12
- } from "./chunk-WL2TKQVN.js";
14
+ } from "./chunk-3Y7RT7QF.js";
13
15
  import {
14
- AppError,
15
- BackendError
16
- } from "./chunk-4MEK3CNF.js";
16
+ isNotFoundError
17
+ } from "./chunk-MPTID5ZR.js";
17
18
  import {
18
19
  usePlayer
19
20
  } from "./chunk-MAKY4YBN.js";
@@ -22,11 +23,12 @@ import {
22
23
  } from "./chunk-W4QTTNNA.js";
23
24
  import {
24
25
  GenrePlaylistUuidSchema,
25
- GenreUuidSchema
26
- } from "./chunk-JMFEWI53.js";
26
+ GenreUuidSchema,
27
+ toGenreUuid
28
+ } from "./chunk-X2QEQR6H.js";
27
29
 
28
30
  // src/genre-tree/useGenre.ts
29
- import { z as z19 } from "zod";
31
+ import { z as z20 } from "zod";
30
32
 
31
33
  // src/genre-tree/schemas/criteria/detailed.ts
32
34
  import { z as z10 } from "zod";
@@ -401,47 +403,61 @@ var useInvalidateAllGenrePlaylistQueries = () => {
401
403
  };
402
404
 
403
405
  // src/genre-tree/schemas/criteria/overview.ts
406
+ import { z as z16 } from "zod";
407
+
408
+ // src/genre-tree/schemas/commons-image.ts
404
409
  import { z as z15 } from "zod";
405
410
 
406
411
  // src/genre-tree/schemas/http-url.ts
407
412
  import { z as z14 } from "zod";
408
413
  var HttpUrlSchema = z14.url({ protocol: /^https?$/ });
409
414
 
415
+ // src/genre-tree/schemas/commons-image.ts
416
+ var CommonsImageSchema = z15.object({
417
+ url: HttpUrlSchema,
418
+ pageUrl: HttpUrlSchema,
419
+ author: z15.string().nullable(),
420
+ license: z15.string(),
421
+ licenseUrl: HttpUrlSchema.nullable()
422
+ });
423
+
410
424
  // src/genre-tree/schemas/criteria/overview.ts
411
- var CriteriaOverviewSchema = z15.object({
425
+ var CriteriaOverviewSchema = z16.object({
412
426
  uuid: GenreUuidSchema,
413
- name: z15.string(),
414
- summary: z15.string().nullable(),
415
- description: z15.string().nullable(),
427
+ name: z16.string(),
428
+ summary: z16.string().nullable(),
429
+ description: z16.string().nullable(),
416
430
  summarySourceUrl: HttpUrlSchema.nullable(),
417
- essentialSongs: z15.array(TrackMinimumSchema).optional()
431
+ // Optional: hosts whose API does not send it (e.g. hear) stay valid.
432
+ image: CommonsImageSchema.nullable().optional(),
433
+ essentialSongs: z16.array(TrackMinimumSchema).optional()
418
434
  });
419
435
 
420
436
  // src/genre-tree/schemas/criteria/simple.ts
421
- import { z as z16 } from "zod";
422
- var CriteriaSimpleSchema = z16.object({
437
+ import { z as z17 } from "zod";
438
+ var CriteriaSimpleSchema = z17.object({
423
439
  uuid: GenreUuidSchema,
424
- name: z16.string(),
440
+ name: z17.string(),
425
441
  parent: CriteriaMinimumSchema.nullable(),
426
- createdOn: z16.string().datetime(),
427
- summary: z16.string().nullable()
442
+ createdOn: z17.string().datetime(),
443
+ summary: z17.string().nullable()
428
444
  });
429
445
 
430
446
  // src/genre-tree/schemas/criteria/creation.ts
431
- import { z as z17 } from "zod";
432
- var CriteriaCreationSchema = z17.object({
433
- name: z17.string().min(1, "Name is required"),
447
+ import { z as z18 } from "zod";
448
+ var CriteriaCreationSchema = z18.object({
449
+ name: z18.string().min(1, "Name is required"),
434
450
  parent: GenreUuidSchema.optional(),
435
- essentialSongs: z17.array(z17.string().uuid()).optional()
451
+ essentialSongs: z18.array(z18.string().uuid()).optional()
436
452
  });
437
453
 
438
454
  // src/genre-tree/schemas/criteria/update.ts
439
- import { z as z18 } from "zod";
440
- var CriteriaUpdateSchema = z18.object({
441
- name: z18.string().optional(),
455
+ import { z as z19 } from "zod";
456
+ var CriteriaUpdateSchema = z19.object({
457
+ name: z19.string().optional(),
442
458
  parent: GenreUuidSchema.nullable().optional(),
443
- essentialSongs: z18.array(z18.string().uuid()).optional(),
444
- side: z18.enum(["core", "pop"]).optional()
459
+ essentialSongs: z19.array(z19.string().uuid()).optional(),
460
+ side: z19.enum(["core", "pop"]).optional()
445
461
  });
446
462
 
447
463
  // src/genre-tree/api/genres/queryKeys.ts
@@ -511,14 +527,18 @@ function useFetchGenreDetail(id, scope, getBackendBaseUrl, schema = scope === "r
511
527
  const { fetch } = useFetchWrapper(getBackendBaseUrl);
512
528
  const queryKeys = scope === "reference" ? genreQueryKeys.reference : genreQueryKeys.me;
513
529
  const endpoints = scope === "reference" ? genreEndpoints.reference : genreEndpoints.me;
514
- const genreUuid = id ?? "";
515
- return useQueryWithParse({
530
+ const validUuid = toGenreUuid(id);
531
+ const genreUuid = validUuid ?? "";
532
+ const { data, error, isPending } = useQueryWithParse({
516
533
  queryKey: scope === "reference" ? [...queryKeys.detail(genreUuid), getBackendBaseUrl(), "genreMusicV1"] : queryKeys.detail(genreUuid),
517
534
  queryFn: () => fetch(endpoints.detail(genreUuid), true, scope === "me"),
518
535
  schema,
519
536
  context: "useFetchGenreDetail",
520
- enabled: id !== null
537
+ enabled: validUuid !== null,
538
+ retry: resourceRetry
521
539
  });
540
+ const result = toResourceResult({ id, isValidId: validUuid !== null, data, error, isPending });
541
+ return result.status === "success" ? { status: "success", genre: result.data } : result;
522
542
  }
523
543
  var GenreByWikidataIdSchema = PaginatedResponseSchema(CriteriaMinimumSchema);
524
544
  function useGenreByWikidataId(qid, scope, getBackendBaseUrl) {
@@ -544,7 +564,8 @@ function useGenreOverviewQueryOptions(scope, getBackendBaseUrl, schema) {
544
564
  return {
545
565
  queryKey: queryKeys.overview(id),
546
566
  queryFn: async () => parseWithLog(schema, await fetch(endpoints.overview(id), true, scope === "me"), "useFetchGenreOverview"),
547
- staleTime: GENRE_OVERVIEW_STALE_TIME_MS
567
+ staleTime: GENRE_OVERVIEW_STALE_TIME_MS,
568
+ retry: resourceRetry
548
569
  };
549
570
  },
550
571
  [fetch, scope, schema]
@@ -596,7 +617,7 @@ function useUpdateGenre(scope, getBackendBaseUrl) {
596
617
  const refreshGenreTree = useRefreshGenreTree(scope);
597
618
  const { fetch } = useFetchWrapper(getBackendBaseUrl);
598
619
  const { mutate, mutateAsync, isPending, formErrors } = useValidatedMutation({
599
- inputSchema: z19.object({
620
+ inputSchema: z20.object({
600
621
  uuid: GenreUuidSchema,
601
622
  data: CriteriaUpdateSchema
602
623
  }),
@@ -626,8 +647,8 @@ function useDeleteGenre(scope, getBackendBaseUrl) {
626
647
  const refreshGenreTree = useRefreshGenreTree(scope);
627
648
  const { fetch } = useFetchWrapper(getBackendBaseUrl);
628
649
  return useValidatedMutation({
629
- inputSchema: z19.object({ uuid: GenreUuidSchema }),
630
- outputSchema: z19.null(),
650
+ inputSchema: z20.object({ uuid: GenreUuidSchema }),
651
+ outputSchema: z20.null(),
631
652
  mutationFn: async ({ uuid }) => {
632
653
  const endpoint = scope === "reference" ? genreEndpoints.reference.delete(uuid) : genreEndpoints.me.delete(uuid);
633
654
  return fetch(endpoint, true, scope === "me", { method: "DELETE" }, void 0, false, true);
@@ -637,16 +658,16 @@ function useDeleteGenre(scope, getBackendBaseUrl) {
637
658
  }
638
659
 
639
660
  // src/genre-tree/useArtist.ts
640
- import { z as z21 } from "zod";
661
+ import { z as z22 } from "zod";
641
662
 
642
663
  // src/genre-tree/schemas/artist-detailed.ts
643
- import { z as z20 } from "zod";
644
- var ArtistMembershipSchema = z20.object({
664
+ import { z as z21 } from "zod";
665
+ var ArtistMembershipSchema = z21.object({
645
666
  artist: ArtistMinimumSchema,
646
- beginYear: z20.number().int().nullable(),
647
- endYear: z20.number().int().nullable(),
648
- ended: z20.boolean(),
649
- roles: z20.array(z20.string())
667
+ beginYear: z21.number().int().nullable(),
668
+ endYear: z21.number().int().nullable(),
669
+ ended: z21.boolean(),
670
+ roles: z21.array(z21.string())
650
671
  });
651
672
  var ARTIST_LINK_KINDS = [
652
673
  "official",
@@ -659,36 +680,30 @@ var ARTIST_LINK_KINDS = [
659
680
  "discogs",
660
681
  "social"
661
682
  ];
662
- var ArtistImageSchema = z20.object({
663
- url: HttpUrlSchema,
664
- pageUrl: HttpUrlSchema,
665
- author: z20.string().nullable(),
666
- license: z20.string(),
667
- licenseUrl: HttpUrlSchema.nullable()
668
- });
669
- var ArtistDetailedSchema = z20.object({
670
- uuid: z20.string().uuid(),
671
- name: z20.string(),
672
- musicbrainzArtistId: z20.string().uuid().nullable(),
673
- type: z20.enum(["person", "group", "orchestra", "choir", "character", "other"]).nullable(),
674
- country: z20.string().nullable(),
675
- beginYear: z20.number().int().nullable(),
676
- endYear: z20.number().int().nullable(),
677
- ended: z20.boolean(),
678
- links: z20.array(z20.object({ kind: z20.enum(ARTIST_LINK_KINDS), url: HttpUrlSchema })),
679
- members: z20.array(ArtistMembershipSchema),
680
- memberOf: z20.array(ArtistMembershipSchema),
681
- albums: z20.array(
682
- z20.object({
683
- uuid: z20.string().uuid(),
684
- name: z20.string(),
685
- year: z20.string().nullable(),
686
- primaryType: z20.string().nullable(),
687
- secondaryTypes: z20.array(z20.string())
683
+ var ArtistImageSchema = CommonsImageSchema;
684
+ var ArtistDetailedSchema = z21.object({
685
+ uuid: z21.string().uuid(),
686
+ name: z21.string(),
687
+ musicbrainzArtistId: z21.string().uuid().nullable(),
688
+ type: z21.enum(["person", "group", "orchestra", "choir", "character", "other"]).nullable(),
689
+ country: z21.string().nullable(),
690
+ beginYear: z21.number().int().nullable(),
691
+ endYear: z21.number().int().nullable(),
692
+ ended: z21.boolean(),
693
+ links: z21.array(z21.object({ kind: z21.enum(ARTIST_LINK_KINDS), url: HttpUrlSchema })),
694
+ members: z21.array(ArtistMembershipSchema),
695
+ memberOf: z21.array(ArtistMembershipSchema),
696
+ albums: z21.array(
697
+ z21.object({
698
+ uuid: z21.string().uuid(),
699
+ name: z21.string(),
700
+ year: z21.string().nullable(),
701
+ primaryType: z21.string().nullable(),
702
+ secondaryTypes: z21.array(z21.string())
688
703
  })
689
704
  ),
690
- tracksCount: z20.number().int(),
691
- playableTracksCount: z20.number().int(),
705
+ tracksCount: z21.number().int(),
706
+ playableTracksCount: z21.number().int(),
692
707
  image: ArtistImageSchema.nullable()
693
708
  });
694
709
 
@@ -708,40 +723,35 @@ var artistEndpoints = {
708
723
  };
709
724
 
710
725
  // src/genre-tree/useArtist.ts
711
- var isNotFound = (error) => error instanceof AppError && error.code === "BAC4040" /* BACKEND_NOT_FOUND */;
712
726
  function useArtist(uuid, getBackendBaseUrl) {
713
727
  const { fetch } = useFetchWrapper(getBackendBaseUrl);
714
- const isUuid = uuid !== null && z21.string().uuid().safeParse(uuid).success;
728
+ const isUuid = uuid !== null && z22.string().uuid().safeParse(uuid).success;
715
729
  const { data, isPending, error } = useQueryWithParse({
716
730
  queryKey: artistQueryKeys.detail(uuid),
717
- // A missing artist is shown in the panel, not raised as an app-wide connectivity error.
718
- queryFn: () => fetch(artistEndpoints.detail(uuid), true, false, void 0, void 0, false, true),
731
+ queryFn: () => fetch(artistEndpoints.detail(uuid), true, false),
719
732
  schema: ArtistDetailedSchema,
720
733
  enabled: isUuid,
721
- retry: (failureCount, retryError) => !isNotFound(retryError) && failureCount < 3,
734
+ retry: resourceRetry,
722
735
  context: "useArtist"
723
736
  });
724
- if (uuid === null) return { status: "idle" };
725
- if (!isUuid || isNotFound(error)) return { status: "not-found" };
726
- if (error) return { status: "error" };
727
- if (isPending) return { status: "loading" };
728
- return { status: "success", artist: data };
737
+ const result = toResourceResult({ id: uuid, isValidId: isUuid, data, error, isPending });
738
+ return result.status === "success" ? { status: "success", artist: result.data } : result;
729
739
  }
730
740
 
731
741
  // src/genre-tree/schemas/artist-search.ts
732
- import { z as z22 } from "zod";
733
- var ArtistSearchResultSchema = z22.object({
734
- uuid: z22.string().uuid(),
735
- name: z22.string(),
736
- disambiguation: z22.string().nullable(),
737
- type: z22.enum(["person", "group", "orchestra", "choir", "character", "other"]).nullable(),
738
- country: z22.string().nullable(),
739
- beginYear: z22.number().int().nullable(),
740
- endYear: z22.number().int().nullable(),
741
- matchedAlias: z22.string().nullable(),
742
- recordingCount: z22.number().int()
742
+ import { z as z23 } from "zod";
743
+ var ArtistSearchResultSchema = z23.object({
744
+ uuid: z23.string().uuid(),
745
+ name: z23.string(),
746
+ disambiguation: z23.string().nullable(),
747
+ type: z23.enum(["person", "group", "orchestra", "choir", "character", "other"]).nullable(),
748
+ country: z23.string().nullable(),
749
+ beginYear: z23.number().int().nullable(),
750
+ endYear: z23.number().int().nullable(),
751
+ matchedAlias: z23.string().nullable(),
752
+ recordingCount: z23.number().int()
743
753
  });
744
- var ArtistSearchResultsSchema = z22.array(ArtistSearchResultSchema);
754
+ var ArtistSearchResultsSchema = z23.array(ArtistSearchResultSchema);
745
755
 
746
756
  // src/genre-tree/useRemoteSearch.ts
747
757
  import { keepPreviousData } from "@tanstack/react-query";
@@ -796,10 +806,10 @@ function useArtistSearch(getBackendBaseUrl, text) {
796
806
  }
797
807
 
798
808
  // src/genre-tree/useSong.ts
799
- import { z as z24 } from "zod";
809
+ import { z as z25 } from "zod";
800
810
 
801
811
  // src/genre-tree/schemas/song/detailed.ts
802
- import { z as z23 } from "zod";
812
+ import { z as z24 } from "zod";
803
813
  var YOUTUBE_UNPLAYABLE_REASON_LABELS = {
804
814
  not_found: "Video unavailable",
805
815
  not_embeddable: "Embedding disabled",
@@ -808,23 +818,23 @@ var YOUTUBE_UNPLAYABLE_REASON_LABELS = {
808
818
  region_whitelisted: "Region restricted"
809
819
  };
810
820
  var YOUTUBE_UNPLAYABLE_REASONS = Object.keys(YOUTUBE_UNPLAYABLE_REASON_LABELS);
811
- var YoutubeAvailabilitySchema = z23.object({
812
- status: z23.enum(["eligible", "blocked", "unknown"]),
813
- reason: z23.string().nullable(),
814
- country: z23.string().nullable()
821
+ var YoutubeAvailabilitySchema = z24.object({
822
+ status: z24.enum(["eligible", "blocked", "unknown"]),
823
+ reason: z24.string().nullable(),
824
+ country: z24.string().nullable()
815
825
  });
816
826
  var SongDetailedSchema = TrackBaseSchema.extend({
817
- youtubeVideo: z23.object({
818
- id: z23.string(),
827
+ youtubeVideo: z24.object({
828
+ id: z24.string(),
819
829
  availability: YoutubeAvailabilitySchema.optional(),
820
830
  // null = playable
821
- unplayableReason: z23.enum(YOUTUBE_UNPLAYABLE_REASONS).nullable(),
822
- viewCount: z23.number().int().nullable().optional()
831
+ unplayableReason: z24.enum(YOUTUBE_UNPLAYABLE_REASONS).nullable(),
832
+ viewCount: z24.number().int().nullable().optional()
823
833
  }).nullable(),
824
834
  // null for hand-made/admin songs
825
- musicbrainzRecordingId: z23.string().uuid().nullable(),
826
- firstReleaseYear: z23.number().int().nullable().optional(),
827
- essentialGenres: z23.array(CriteriaMinimumSchema).optional()
835
+ musicbrainzRecordingId: z24.string().uuid().nullable(),
836
+ firstReleaseYear: z24.number().int().nullable().optional(),
837
+ essentialGenres: z24.array(CriteriaMinimumSchema).optional()
828
838
  });
829
839
  var NO_VIDEO_LABEL = "No video available";
830
840
  function isSong(track) {
@@ -841,37 +851,32 @@ function musicBrainzRecordingUrl(song) {
841
851
  }
842
852
 
843
853
  // src/genre-tree/useSong.ts
844
- var isNotFound2 = (error) => error instanceof AppError && error.code === "BAC4040" /* BACKEND_NOT_FOUND */;
845
854
  function useSong(uuid, getBackendBaseUrl) {
846
- const isUuid = uuid !== null && z24.string().uuid().safeParse(uuid).success;
855
+ const isUuid = uuid !== null && z25.string().uuid().safeParse(uuid).success;
847
856
  const { data, isPending, error } = usePlaybackQuery({
848
857
  getBackendBaseUrl,
849
858
  queryKey: libraryQueryKeys.reference.songs.detail(uuid),
850
- // A missing song is shown in the panel, not raised as an app-wide connectivity error.
851
- queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.detail(uuid), true, false, { signal }, void 0, false, true),
859
+ queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.detail(uuid), true, false, { signal }),
852
860
  schema: SongDetailedSchema,
853
861
  enabled: isUuid,
854
- retry: (failureCount, retryError) => !isNotFound2(retryError) && failureCount < 3,
862
+ retry: resourceRetry,
855
863
  context: "useSong"
856
864
  });
857
- if (uuid === null) return { status: "idle" };
858
- if (!isUuid || isNotFound2(error)) return { status: "not-found" };
859
- if (error) return { status: "error" };
860
- if (isPending) return { status: "loading" };
861
- return { status: "success", song: data };
865
+ const result = toResourceResult({ id: uuid, isValidId: isUuid, data, error, isPending });
866
+ return result.status === "success" ? { status: "success", song: result.data } : result;
862
867
  }
863
868
 
864
869
  // src/genre-tree/schemas/song-history.ts
865
- import { z as z25 } from "zod";
866
- var SongHistoryEntrySchema = z25.object({
867
- uuid: z25.string().uuid(),
868
- action: z25.string(),
869
- actorPseudo: z25.string().nullable(),
870
- oldValue: z25.string().nullable(),
871
- newValue: z25.string().nullable(),
872
- createdOn: z25.string()
870
+ import { z as z26 } from "zod";
871
+ var SongHistoryEntrySchema = z26.object({
872
+ uuid: z26.string().uuid(),
873
+ action: z26.string(),
874
+ actorPseudo: z26.string().nullable(),
875
+ oldValue: z26.string().nullable(),
876
+ newValue: z26.string().nullable(),
877
+ createdOn: z26.string()
873
878
  });
874
- var SongHistorySchema = z25.array(SongHistoryEntrySchema);
879
+ var SongHistorySchema = z26.array(SongHistoryEntrySchema);
875
880
 
876
881
  // src/genre-tree/useSongHistory.ts
877
882
  function useSongHistory(uuid, getBackendBaseUrl, enabled) {
@@ -879,7 +884,7 @@ function useSongHistory(uuid, getBackendBaseUrl, enabled) {
879
884
  const { data, isPending, error } = usePlaybackQuery({
880
885
  getBackendBaseUrl,
881
886
  queryKey: libraryQueryKeys.reference.songs.history(uuid),
882
- queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.history(uuid), true, false, { signal }, void 0, false, true),
887
+ queryFn: (fetchBound, { signal }) => fetchBound(libraryEndpoints.reference.songs.history(uuid), true, false, { signal }),
883
888
  schema: SongHistorySchema,
884
889
  enabled: active,
885
890
  context: "useSongHistory"
@@ -891,20 +896,20 @@ function useSongHistory(uuid, getBackendBaseUrl, enabled) {
891
896
  }
892
897
 
893
898
  // src/genre-tree/schemas/song-search.ts
894
- import { z as z26 } from "zod";
895
- var SongSearchResultSchema = z26.object({
896
- uuid: z26.string().uuid(),
897
- title: z26.string(),
898
- artists: z26.array(ArtistMinimumSchema),
899
+ import { z as z27 } from "zod";
900
+ var SongSearchResultSchema = z27.object({
901
+ uuid: z27.string().uuid(),
902
+ title: z27.string(),
903
+ artists: z27.array(ArtistMinimumSchema),
899
904
  // null for songs not yet linked to a genre.
900
905
  genre: CriteriaMinimumSchema.nullable(),
901
- youtubeVideo: z26.object({
902
- id: z26.string(),
903
- unplayableReason: z26.string().nullable()
906
+ youtubeVideo: z27.object({
907
+ id: z27.string(),
908
+ unplayableReason: z27.string().nullable()
904
909
  }).nullable(),
905
- firstReleaseYear: z26.number().int().nullable()
910
+ firstReleaseYear: z27.number().int().nullable()
906
911
  });
907
- var SongSearchResultsSchema = z26.array(SongSearchResultSchema);
912
+ var SongSearchResultsSchema = z27.array(SongSearchResultSchema);
908
913
  function isSongSearchResultPlayable(result) {
909
914
  return result.youtubeVideo !== null && result.youtubeVideo.unplayableReason === null;
910
915
  }
@@ -932,18 +937,18 @@ function useSongSearch(getBackendBaseUrl, text, options = {}) {
932
937
 
933
938
  // src/genre-tree/useArtistGenreCounts.ts
934
939
  import { keepPreviousData as keepPreviousData2 } from "@tanstack/react-query";
935
- import { z as z28 } from "zod";
940
+ import { z as z29 } from "zod";
936
941
 
937
942
  // src/genre-tree/schemas/artist-genre-count.ts
938
- import { z as z27 } from "zod";
939
- var ArtistGenreCountSchema = z27.object({
943
+ import { z as z28 } from "zod";
944
+ var ArtistGenreCountSchema = z28.object({
940
945
  ...GenreCountsSchema.shape,
941
946
  catalogue: GenreCatalogueCountsSchema,
942
947
  genrePlaylist: GenrePlaylistUuidSchema,
943
948
  /** Legacy catalogue count for the default selection. */
944
- songsCount: z27.number().int().nonnegative(),
949
+ songsCount: z28.number().int().nonnegative(),
945
950
  /** Legacy playlist count for the default selection. */
946
- tracksCount: z27.number().int().nonnegative()
951
+ tracksCount: z28.number().int().nonnegative()
947
952
  }).superRefine((row, ctx) => {
948
953
  const counts = GenreCatalogueCountsSchema.safeParse(row);
949
954
  if (!counts.success) {
@@ -954,17 +959,15 @@ var ArtistGenreCountSchema = z27.object({
954
959
  });
955
960
 
956
961
  // src/genre-tree/useArtistGenreCounts.ts
957
- var isNotFound3 = (error) => error instanceof AppError && error.code === "BAC4040" /* BACKEND_NOT_FOUND */;
958
962
  function useArtistGenreCounts(artistUuid, getBackendBaseUrl) {
959
963
  const { fetch } = useFetchWrapper(getBackendBaseUrl);
960
964
  return useQueryWithParse({
961
965
  queryKey: [...artistQueryKeys.genreCounts(getBackendBaseUrl(), artistUuid), "genreMusicV1"],
962
- // A missing artist is shown in the artist panel, not raised as an app-wide connectivity error.
963
- queryFn: () => fetch(artistEndpoints.genreCounts(artistUuid), true, false, void 0, void 0, false, true),
964
- schema: z28.array(ArtistGenreCountSchema),
966
+ queryFn: () => fetch(artistEndpoints.genreCounts(artistUuid), true, false),
967
+ schema: z29.array(ArtistGenreCountSchema),
965
968
  enabled: artistUuid !== null,
966
969
  placeholderData: keepPreviousData2,
967
- retry: (failureCount, error) => !isNotFound3(error) && failureCount < 3,
970
+ retry: resourceRetry,
968
971
  context: "useArtistGenreCounts"
969
972
  });
970
973
  }
@@ -1121,32 +1124,32 @@ function useGenreSearch({
1121
1124
  }
1122
1125
 
1123
1126
  // src/genre-tree/schemas/genre-search.ts
1124
- import { z as z29 } from "zod";
1125
- var GenreSearchTreeNameSchema = z29.enum(["canonical", "regional"]);
1126
- var GenreSearchResultSchema = z29.object({
1127
+ import { z as z30 } from "zod";
1128
+ var GenreSearchTreeNameSchema = z30.enum(["canonical", "regional"]);
1129
+ var GenreSearchResultSchema = z30.object({
1127
1130
  /** Criteria (genre) uuid. */
1128
1131
  uuid: GenreUuidSchema,
1129
- name: z29.string(),
1132
+ name: z30.string(),
1130
1133
  /** Null for app-created genres, which the Wikidata-keyed region index does not reference. */
1131
- wikidataId: z29.string().nullable(),
1132
- treeName: z29.string(),
1134
+ wikidataId: z30.string().nullable(),
1135
+ treeName: z30.string(),
1133
1136
  /** Null when the genre has no playlist in the tree, so it cannot be opened there. */
1134
1137
  genrePlaylistUuid: GenrePlaylistUuidSchema.nullable(),
1135
- root: z29.object({ uuid: GenreUuidSchema, name: z29.string() }),
1136
- isUmbrella: z29.boolean(),
1137
- viewsCount: z29.number().int()
1138
+ root: z30.object({ uuid: GenreUuidSchema, name: z30.string() }),
1139
+ isUmbrella: z30.boolean(),
1140
+ viewsCount: z30.number().int()
1138
1141
  });
1139
- var GenreSearchResultsSchema = z29.array(GenreSearchResultSchema);
1140
- var RegionGenreLexiconEntrySchema = z29.object({
1141
- wikidataId: z29.string(),
1142
+ var GenreSearchResultsSchema = z30.array(GenreSearchResultSchema);
1143
+ var RegionGenreLexiconEntrySchema = z30.object({
1144
+ wikidataId: z30.string(),
1142
1145
  uuid: GenreUuidSchema,
1143
- name: z29.string(),
1144
- treeName: z29.string(),
1146
+ name: z30.string(),
1147
+ treeName: z30.string(),
1145
1148
  genrePlaylistUuid: GenrePlaylistUuidSchema.nullable(),
1146
- isUmbrella: z29.boolean(),
1147
- viewsCount: z29.number().int()
1149
+ isUmbrella: z30.boolean(),
1150
+ viewsCount: z30.number().int()
1148
1151
  });
1149
- var RegionGenreLexiconSchema = z29.array(RegionGenreLexiconEntrySchema);
1152
+ var RegionGenreLexiconSchema = z30.array(RegionGenreLexiconEntrySchema);
1150
1153
 
1151
1154
  // src/genre-tree/useGenreRemoteSearch.ts
1152
1155
  var DEFAULT_RESULT_LIMIT2 = 8;
@@ -1368,10 +1371,10 @@ function useGenreTreeViewState({
1368
1371
  import { createContext as createContext2, useState as useState5, useContext as useContext2, useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo5, useRef as useRef3 } from "react";
1369
1372
 
1370
1373
  // src/genre-tree/schemas/track-playlist-rel/without-playlist.ts
1371
- import { z as z30 } from "zod";
1372
- var makeTrackPlaylistRelSchema = (trackSchema) => z30.object({
1374
+ import { z as z31 } from "zod";
1375
+ var makeTrackPlaylistRelSchema = (trackSchema) => z31.object({
1373
1376
  track: trackSchema,
1374
- position: z30.number().min(0)
1377
+ position: z31.number().min(0)
1375
1378
  });
1376
1379
  var makeTrackPlaylistRelPageSchema = (trackSchema) => PaginatedResponseSchema(makeTrackPlaylistRelSchema(trackSchema));
1377
1380
 
@@ -1815,7 +1818,7 @@ function TrackListProvider({
1815
1818
  setSelectedTrack(null);
1816
1819
  if (origin instanceof TrackListOriginFromCriteriaPlaylist) {
1817
1820
  void playNewTrackListFromGenrePlaylist(origin.criteriaPlaylist, origin.scope, { startSongUuid: selected?.uuid, selection: origin.selection, artistUuid: origin.artistUuid }).catch((error) => {
1818
- if (error instanceof BackendError && error.code === "BAC4040" /* BACKEND_NOT_FOUND */) {
1821
+ if (isNotFoundError(error)) {
1819
1822
  return playNewTrackListFromGenrePlaylist(origin.criteriaPlaylist, origin.scope, { selection: origin.selection, artistUuid: origin.artistUuid }).catch(() => {
1820
1823
  });
1821
1824
  }
@@ -1823,7 +1826,7 @@ function TrackListProvider({
1823
1826
  } else if (origin instanceof TrackListOriginFromArtist) {
1824
1827
  const options = { ordering: origin.ordering, genreUuid: origin.genreUuid, selection: origin.selection };
1825
1828
  void playNewTrackListFromArtist(origin.artist, origin.scope, { ...options, startSongUuid: selected?.uuid }).catch((error) => {
1826
- if (error instanceof BackendError && error.code === "BAC4040" /* BACKEND_NOT_FOUND */) {
1829
+ if (isNotFoundError(error)) {
1827
1830
  return playNewTrackListFromArtist(origin.artist, origin.scope, options).catch(() => {
1828
1831
  });
1829
1832
  }
@@ -1831,7 +1834,7 @@ function TrackListProvider({
1831
1834
  } else if (origin instanceof TrackListOriginFromGenreCatalogue) {
1832
1835
  const options = { selection: origin.selection };
1833
1836
  void playNewTrackListFromGenreCatalogue(origin.genre, origin.scope, { ...options, startSongUuid: selected?.uuid }).catch((error) => {
1834
- if (error instanceof BackendError && error.code === "BAC4040" /* BACKEND_NOT_FOUND */) {
1837
+ if (isNotFoundError(error)) {
1835
1838
  return playNewTrackListFromGenreCatalogue(origin.genre, origin.scope, options).catch(() => {
1836
1839
  });
1837
1840
  }
@@ -2010,24 +2013,24 @@ function ArtistNames({
2010
2013
  }
2011
2014
 
2012
2015
  // src/genre-tree/schemas/mb-artist.ts
2013
- import { z as z31 } from "zod";
2014
- var MbArtistDetailedSchema = z31.object({
2015
- musicbrainzId: z31.string().uuid(),
2016
- name: z31.string(),
2016
+ import { z as z32 } from "zod";
2017
+ var MbArtistDetailedSchema = z32.object({
2018
+ musicbrainzId: z32.string().uuid(),
2019
+ name: z32.string(),
2017
2020
  musicbrainzLink: HttpUrlSchema
2018
2021
  });
2019
2022
 
2020
2023
  // src/genre-tree/schemas/mb-recording.ts
2021
- import { z as z32 } from "zod";
2022
- var MbRecordingDetailedSchema = z32.object({
2023
- musicbrainzId: z32.string().uuid(),
2024
- title: z32.string(),
2025
- score: z32.number(),
2026
- musicbrainzArtists: z32.array(MbArtistDetailedSchema),
2024
+ import { z as z33 } from "zod";
2025
+ var MbRecordingDetailedSchema = z33.object({
2026
+ musicbrainzId: z33.string().uuid(),
2027
+ title: z33.string(),
2028
+ score: z33.number(),
2029
+ musicbrainzArtists: z33.array(MbArtistDetailedSchema),
2027
2030
  musicbrainzLink: HttpUrlSchema,
2028
- durationInSec: z32.number().min(0).nullable().optional(),
2029
- durationStrInHourMinSec: z32.string().nullable().optional(),
2030
- releaseDate: z32.union([z32.string().datetime(), z32.string()]).transform((val) => {
2031
+ durationInSec: z33.number().min(0).nullable().optional(),
2032
+ durationStrInHourMinSec: z33.string().nullable().optional(),
2033
+ releaseDate: z33.union([z33.string().datetime(), z33.string()]).transform((val) => {
2031
2034
  try {
2032
2035
  const date = new Date(val);
2033
2036
  if (isNaN(date.getTime())) {
@@ -2129,6 +2132,7 @@ export {
2129
2132
  useListFullGenrePlaylists,
2130
2133
  useFetchGenrePlaylist,
2131
2134
  useInvalidateAllGenrePlaylistQueries,
2135
+ CommonsImageSchema,
2132
2136
  CriteriaOverviewSchema,
2133
2137
  CriteriaSimpleSchema,
2134
2138
  CriteriaCreationSchema,
@@ -2223,4 +2227,4 @@ export {
2223
2227
  getReparentCandidates,
2224
2228
  editGenreSongPages
2225
2229
  };
2226
- //# sourceMappingURL=chunk-D5UFJF4K.js.map
2230
+ //# sourceMappingURL=chunk-4E3YMYDH.js.map