@behindthemusictree/app-kit 41.0.0 → 42.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.
- package/dist/{chunk-4E3YMYDH.js → chunk-QNBZQZEL.js} +119 -107
- package/dist/chunk-QNBZQZEL.js.map +1 -0
- package/dist/chunk-RGHDVBEY.js +26 -0
- package/dist/chunk-RGHDVBEY.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
|
@@ -3,8 +3,8 @@ import { QueryKey, InfiniteData } from '@tanstack/react-query';
|
|
|
3
3
|
import * as zod from 'zod';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { R as ResourceResult, S as Scope, u as useFetchWrapper } from '../useFetchWrapper-H0lO4wFO.js';
|
|
6
|
-
import {
|
|
7
|
-
export { a as GenrePlaylistUuidSchema,
|
|
6
|
+
import { c as GenreUuid, G as GenrePlaylistUuid } from '../ids-FmUQ8DVM.js';
|
|
7
|
+
export { A as ArtistUuid, a as ArtistUuidSchema, b as GenrePlaylistUuidSchema, d as GenreUuidSchema, S as SongUuid, e as SongUuidSchema, t as toArtistUuid, f as toGenreUuid, g as toSongUuid } from '../ids-FmUQ8DVM.js';
|
|
8
8
|
import * as react from 'react';
|
|
9
9
|
import { ReactNode } from 'react';
|
|
10
10
|
|
|
@@ -3372,6 +3372,18 @@ declare const ArtistImageSchema: z.ZodObject<{
|
|
|
3372
3372
|
license: z.ZodString;
|
|
3373
3373
|
licenseUrl: z.ZodNullable<z.ZodURL>;
|
|
3374
3374
|
}, z.core.$strip>;
|
|
3375
|
+
declare const ArtistOriginSchema: z.ZodObject<{
|
|
3376
|
+
name: z.ZodString;
|
|
3377
|
+
kind: z.ZodString;
|
|
3378
|
+
source: z.ZodEnum<{
|
|
3379
|
+
area: "area";
|
|
3380
|
+
begin_area: "begin_area";
|
|
3381
|
+
}>;
|
|
3382
|
+
wikidataId: z.ZodNullable<z.ZodString>;
|
|
3383
|
+
longitude: z.ZodNullable<z.ZodNumber>;
|
|
3384
|
+
latitude: z.ZodNullable<z.ZodNumber>;
|
|
3385
|
+
regionId: z.ZodNullable<z.ZodString>;
|
|
3386
|
+
}, z.core.$strip>;
|
|
3375
3387
|
declare const ArtistDetailedSchema: z.ZodObject<{
|
|
3376
3388
|
uuid: z.ZodString;
|
|
3377
3389
|
name: z.ZodString;
|
|
@@ -3440,8 +3452,21 @@ declare const ArtistDetailedSchema: z.ZodObject<{
|
|
|
3440
3452
|
license: z.ZodString;
|
|
3441
3453
|
licenseUrl: z.ZodNullable<z.ZodURL>;
|
|
3442
3454
|
}, z.core.$strip>>;
|
|
3455
|
+
origin: z.ZodNullable<z.ZodObject<{
|
|
3456
|
+
name: z.ZodString;
|
|
3457
|
+
kind: z.ZodString;
|
|
3458
|
+
source: z.ZodEnum<{
|
|
3459
|
+
area: "area";
|
|
3460
|
+
begin_area: "begin_area";
|
|
3461
|
+
}>;
|
|
3462
|
+
wikidataId: z.ZodNullable<z.ZodString>;
|
|
3463
|
+
longitude: z.ZodNullable<z.ZodNumber>;
|
|
3464
|
+
latitude: z.ZodNullable<z.ZodNumber>;
|
|
3465
|
+
regionId: z.ZodNullable<z.ZodString>;
|
|
3466
|
+
}, z.core.$strip>>;
|
|
3443
3467
|
}, z.core.$strip>;
|
|
3444
3468
|
type ArtistImage = CommonsImage;
|
|
3469
|
+
type ArtistOrigin = z.infer<typeof ArtistOriginSchema>;
|
|
3445
3470
|
type ArtistDetailed = z.infer<typeof ArtistDetailedSchema>;
|
|
3446
3471
|
type ArtistMembership = ArtistDetailed["members"][number];
|
|
3447
3472
|
type ArtistLink = ArtistDetailed["links"][number];
|
|
@@ -3453,6 +3478,7 @@ type UseArtistResult = Exclude<ResourceResult<ArtistDetailed>, {
|
|
|
3453
3478
|
status: "success";
|
|
3454
3479
|
artist: ArtistDetailed;
|
|
3455
3480
|
};
|
|
3481
|
+
/** `null` = absent (idle); any string is validated, and a malformed one is not found without a request. */
|
|
3456
3482
|
declare function useArtist(uuid: string | null, getBackendBaseUrl: () => string): UseArtistResult;
|
|
3457
3483
|
|
|
3458
3484
|
declare const ArtistSearchResultSchema: z.ZodObject<{
|
|
@@ -3633,6 +3659,7 @@ type UseSongResult = Exclude<ResourceResult<SongDetailed>, {
|
|
|
3633
3659
|
status: "success";
|
|
3634
3660
|
song: SongDetailed;
|
|
3635
3661
|
};
|
|
3662
|
+
/** `null` = absent (idle); any string is validated, and a malformed one is not found without a request. */
|
|
3636
3663
|
declare function useSong(uuid: string | null, getBackendBaseUrl: () => string): UseSongResult;
|
|
3637
3664
|
|
|
3638
3665
|
declare const SongHistoryEntrySchema: z.ZodObject<{
|
|
@@ -3663,7 +3690,7 @@ type UseSongHistoryResult = {
|
|
|
3663
3690
|
status: "success";
|
|
3664
3691
|
entries: SongHistoryEntry[];
|
|
3665
3692
|
};
|
|
3666
|
-
/** Lazy: nothing is fetched until `enabled`, e.g. while the panel's History section is open. */
|
|
3693
|
+
/** Lazy: nothing is fetched until `enabled`, e.g. while the panel's History section is open. A null or malformed `uuid` stays idle. */
|
|
3667
3694
|
declare function useSongHistory(uuid: string | null, getBackendBaseUrl: () => string, enabled: boolean): UseSongHistoryResult;
|
|
3668
3695
|
|
|
3669
3696
|
declare const SongSearchResultSchema: z.ZodObject<{
|
|
@@ -3733,7 +3760,7 @@ interface UseSongSearchResult {
|
|
|
3733
3760
|
}
|
|
3734
3761
|
declare function useSongSearch(getBackendBaseUrl: () => string, text: string, options?: Omit<SongSearchParams, "q">): UseSongSearchResult;
|
|
3735
3762
|
|
|
3736
|
-
/** The artist's footprint on the canonical tree (sparse: non-zero genre playlists only). Idle while `artistUuid` is null. */
|
|
3763
|
+
/** The artist's footprint on the canonical tree (sparse: non-zero genre playlists only). Idle while `artistUuid` is null or malformed, with no request. */
|
|
3737
3764
|
declare function useArtistGenreCounts(artistUuid: string | null, getBackendBaseUrl: () => string): _tanstack_react_query.UseQueryResult<NoInfer<{
|
|
3738
3765
|
catalogue: {
|
|
3739
3766
|
genreOnlyTracksCount: number;
|
|
@@ -4034,7 +4061,7 @@ interface UseVisibleGenrePlaylistsOptions {
|
|
|
4034
4061
|
* carries the artist's counts and `focusUuids` names their footprint (undefined otherwise); genres
|
|
4035
4062
|
* outside it stay navigable and renderers draw them muted. While the artist's counts load the
|
|
4036
4063
|
* current tree stays (with the previous artist's projection) and `isFetching` is true; `isLoading`
|
|
4037
|
-
* is true only until the first tree arrives. If the counts fail (unknown artist, backend error) the
|
|
4064
|
+
* is true only until the first tree arrives. If the counts fail (unknown or malformed artist, backend error) the
|
|
4038
4065
|
* plain tree is served, the artist panel being where that failure is shown.
|
|
4039
4066
|
*/
|
|
4040
4067
|
declare function useVisibleGenrePlaylists({ scope, getBackendBaseUrl, artistUuid }: UseVisibleGenrePlaylistsOptions): {
|
|
@@ -4413,6 +4440,11 @@ type RenderSongLink = (song: {
|
|
|
4413
4440
|
title: string;
|
|
4414
4441
|
}) => ReactNode;
|
|
4415
4442
|
|
|
4443
|
+
/** Renders an artist's origin place as a link to its map region — typically the consumer's router `Link`. Only called when the origin has a `regionId`. */
|
|
4444
|
+
type RenderPlaceLink = (origin: ArtistOrigin & {
|
|
4445
|
+
regionId: string;
|
|
4446
|
+
}) => ReactNode;
|
|
4447
|
+
|
|
4416
4448
|
declare const UuidResourceSchema: z.ZodObject<{
|
|
4417
4449
|
uuid: z.ZodString;
|
|
4418
4450
|
}, z.core.$strip>;
|
|
@@ -5018,4 +5050,4 @@ declare const ReferenceGenrePlaylistSchema: z.ZodObject<{
|
|
|
5018
5050
|
type ReferenceGenreDetailed = z.infer<typeof ReferenceGenreDetailedSchema>;
|
|
5019
5051
|
type ReferenceGenrePlaylist = z.infer<typeof ReferenceGenrePlaylistSchema>;
|
|
5020
5052
|
|
|
5021
|
-
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, type CommonsImage, CommonsImageSchema, 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 UseGenreResult, 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 };
|
|
5053
|
+
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 ArtistOrigin, ArtistOriginSchema, type ArtistSearchResult, ArtistSearchResultSchema, ArtistSearchResultsSchema, type ArtistSongsOrdering, type ArtistTrackListOriginInput, type CommonsImage, CommonsImageSchema, 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 RenderPlaceLink, 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 UseGenreResult, 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
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ArtistImageSchema,
|
|
7
7
|
ArtistMinimumSchema,
|
|
8
8
|
ArtistNames,
|
|
9
|
+
ArtistOriginSchema,
|
|
9
10
|
ArtistSearchResultSchema,
|
|
10
11
|
ArtistSearchResultsSchema,
|
|
11
12
|
CommonsImageSchema,
|
|
@@ -126,17 +127,21 @@ import {
|
|
|
126
127
|
useTrackListSidebarVisibility,
|
|
127
128
|
useUpdateGenre,
|
|
128
129
|
useVisibleGenrePlaylists
|
|
129
|
-
} from "../chunk-
|
|
130
|
+
} from "../chunk-QNBZQZEL.js";
|
|
130
131
|
import "../chunk-WHJNRJRZ.js";
|
|
131
132
|
import "../chunk-3Y7RT7QF.js";
|
|
132
133
|
import "../chunk-MPTID5ZR.js";
|
|
133
134
|
import "../chunk-MAKY4YBN.js";
|
|
134
135
|
import "../chunk-W4QTTNNA.js";
|
|
135
136
|
import {
|
|
137
|
+
ArtistUuidSchema,
|
|
136
138
|
GenrePlaylistUuidSchema,
|
|
137
139
|
GenreUuidSchema,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
SongUuidSchema,
|
|
141
|
+
toArtistUuid,
|
|
142
|
+
toGenreUuid,
|
|
143
|
+
toSongUuid
|
|
144
|
+
} from "../chunk-RGHDVBEY.js";
|
|
140
145
|
export {
|
|
141
146
|
ARTIST_LINK_KINDS,
|
|
142
147
|
AlbumMinimumSchema,
|
|
@@ -145,8 +150,10 @@ export {
|
|
|
145
150
|
ArtistImageSchema,
|
|
146
151
|
ArtistMinimumSchema,
|
|
147
152
|
ArtistNames,
|
|
153
|
+
ArtistOriginSchema,
|
|
148
154
|
ArtistSearchResultSchema,
|
|
149
155
|
ArtistSearchResultsSchema,
|
|
156
|
+
ArtistUuidSchema,
|
|
150
157
|
CommonsImageSchema,
|
|
151
158
|
CriteriaCreationSchema,
|
|
152
159
|
CriteriaDetailedSchema,
|
|
@@ -184,6 +191,7 @@ export {
|
|
|
184
191
|
SongHistorySchema,
|
|
185
192
|
SongSearchResultSchema,
|
|
186
193
|
SongSearchResultsSchema,
|
|
194
|
+
SongUuidSchema,
|
|
187
195
|
SubgenreCountsSchema,
|
|
188
196
|
SubgenreScopeSchema,
|
|
189
197
|
TrackBaseSchema,
|
|
@@ -237,7 +245,9 @@ export {
|
|
|
237
245
|
rankNameIndex,
|
|
238
246
|
searchGenrePlaylistsByName,
|
|
239
247
|
songUnplayableReason,
|
|
248
|
+
toArtistUuid,
|
|
240
249
|
toGenreUuid,
|
|
250
|
+
toSongUuid,
|
|
241
251
|
trigramSimilarity,
|
|
242
252
|
useArtist,
|
|
243
253
|
useArtistGenreCounts,
|
|
@@ -29,6 +29,17 @@ module.exports = __toCommonJS(testing_exports);
|
|
|
29
29
|
var import_zod = require("zod");
|
|
30
30
|
var GenreUuidSchema = import_zod.z.string().uuid().brand();
|
|
31
31
|
var GenrePlaylistUuidSchema = import_zod.z.string().uuid().brand();
|
|
32
|
+
var ArtistUuidSchema = import_zod.z.string().uuid().brand();
|
|
33
|
+
var SongUuidSchema = import_zod.z.string().uuid().brand();
|
|
34
|
+
function toId(schema) {
|
|
35
|
+
return (value) => {
|
|
36
|
+
const parsed = schema.safeParse(value);
|
|
37
|
+
return parsed.success ? parsed.data : null;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
var toGenreUuid = toId(GenreUuidSchema);
|
|
41
|
+
var toArtistUuid = toId(ArtistUuidSchema);
|
|
42
|
+
var toSongUuid = toId(SongUuidSchema);
|
|
32
43
|
|
|
33
44
|
// src/genre-tree/testing.ts
|
|
34
45
|
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/genre-tree/testing.ts","../../src/genre-tree/schemas/ids.ts"],"sourcesContent":["import { GenrePlaylistUuidSchema, GenreUuidSchema, type GenrePlaylistUuid, type GenreUuid } from \"./schemas/ids\";\n\n// Test fixtures only. A readable name (\"jazz\") maps to a stable UUID, so the same name yields the same id across runs.\n// Genre and playlist names are salted apart so the two id spaces never collide.\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction fnv1a(input: string, offsetBasis: number): number {\n let hash = offsetBasis;\n for (let index = 0; index < input.length; index++) {\n hash ^= input.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return hash >>> 0;\n}\n\nfunction nameToUuid(salt: string, name: string): string {\n const hex = [0x811c9dc5, 0x01000193, 0x5bd1e995, 0x27d4eb2f]\n .map((offsetBasis) => fnv1a(`${salt}:${name}`, offsetBasis).toString(16).padStart(8, \"0\"))\n .join(\"\");\n const variant = ((parseInt(hex[16], 16) & 0x3) | 0x8).toString(16);\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`;\n}\n\nexport const makeGenreUuid = (value: string): GenreUuid =>\n GenreUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre\", value));\n\nexport const makeGenrePlaylistUuid = (value: string): GenrePlaylistUuid =>\n GenrePlaylistUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre-playlist\", value));\n","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 type GenreUuid = z.infer<typeof GenreUuidSchema>;\nexport type GenrePlaylistUuid = z.infer<typeof GenrePlaylistUuidSchema>;\n\n/** The id as a `GenreUuid`, or null when it is absent or malformed (e.g. a raw URL value). */\nexport
|
|
1
|
+
{"version":3,"sources":["../../src/genre-tree/testing.ts","../../src/genre-tree/schemas/ids.ts"],"sourcesContent":["import { GenrePlaylistUuidSchema, GenreUuidSchema, type GenrePlaylistUuid, type GenreUuid } from \"./schemas/ids\";\n\n// Test fixtures only. A readable name (\"jazz\") maps to a stable UUID, so the same name yields the same id across runs.\n// Genre and playlist names are salted apart so the two id spaces never collide.\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nfunction fnv1a(input: string, offsetBasis: number): number {\n let hash = offsetBasis;\n for (let index = 0; index < input.length; index++) {\n hash ^= input.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return hash >>> 0;\n}\n\nfunction nameToUuid(salt: string, name: string): string {\n const hex = [0x811c9dc5, 0x01000193, 0x5bd1e995, 0x27d4eb2f]\n .map((offsetBasis) => fnv1a(`${salt}:${name}`, offsetBasis).toString(16).padStart(8, \"0\"))\n .join(\"\");\n const variant = ((parseInt(hex[16], 16) & 0x3) | 0x8).toString(16);\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`;\n}\n\nexport const makeGenreUuid = (value: string): GenreUuid =>\n GenreUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre\", value));\n\nexport const makeGenrePlaylistUuid = (value: string): GenrePlaylistUuid =>\n GenrePlaylistUuidSchema.parse(UUID_PATTERN.test(value) ? value : nameToUuid(\"genre-playlist\", value));\n","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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAIX,IAAM,kBAAkB,aAAE,OAAO,EAAE,KAAK,EAAE,MAAmB;AAC7D,IAAM,0BAA0B,aAAE,OAAO,EAAE,KAAK,EAAE,MAA2B;AAE7E,IAAM,mBAAmB,aAAE,OAAO,EAAE,KAAK,EAAE,MAAoB;AAC/D,IAAM,iBAAiB,aAAE,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;;;ADzB7C,IAAM,eAAe;AAErB,SAAS,MAAM,OAAe,aAA6B;AACzD,MAAI,OAAO;AACX,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS;AACjD,YAAQ,MAAM,WAAW,KAAK;AAC9B,WAAO,KAAK,KAAK,MAAM,QAAU;AAAA,EACnC;AACA,SAAO,SAAS;AAClB;AAEA,SAAS,WAAW,MAAc,MAAsB;AACtD,QAAM,MAAM,CAAC,YAAY,UAAY,YAAY,SAAU,EACxD,IAAI,CAAC,gBAAgB,MAAM,GAAG,IAAI,IAAI,IAAI,IAAI,WAAW,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EACxF,KAAK,EAAE;AACV,QAAM,WAAY,SAAS,IAAI,EAAE,GAAG,EAAE,IAAI,IAAO,GAAK,SAAS,EAAE;AACjE,SAAO,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,OAAO,GAAG,IAAI,MAAM,IAAI,EAAE,CAAC,IAAI,IAAI,MAAM,IAAI,EAAE,CAAC;AACzH;AAEO,IAAM,gBAAgB,CAAC,UAC5B,gBAAgB,MAAM,aAAa,KAAK,KAAK,IAAI,QAAQ,WAAW,SAAS,KAAK,CAAC;AAE9E,IAAM,wBAAwB,CAAC,UACpC,wBAAwB,MAAM,aAAa,KAAK,KAAK,IAAI,QAAQ,WAAW,kBAAkB,KAAK,CAAC;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const GenreUuidSchema: z.core.$ZodBranded<z.ZodString, "GenreUuid", "out">;
|
|
4
|
+
declare const GenrePlaylistUuidSchema: z.core.$ZodBranded<z.ZodString, "GenrePlaylistUuid", "out">;
|
|
5
|
+
declare const ArtistUuidSchema: z.core.$ZodBranded<z.ZodString, "ArtistUuid", "out">;
|
|
6
|
+
declare const SongUuidSchema: z.core.$ZodBranded<z.ZodString, "SongUuid", "out">;
|
|
7
|
+
type GenreUuid = z.infer<typeof GenreUuidSchema>;
|
|
8
|
+
type GenrePlaylistUuid = z.infer<typeof GenrePlaylistUuidSchema>;
|
|
9
|
+
type ArtistUuid = z.infer<typeof ArtistUuidSchema>;
|
|
10
|
+
type SongUuid = z.infer<typeof SongUuidSchema>;
|
|
11
|
+
/** The id as a `GenreUuid`, or null when it is absent or malformed (e.g. a raw URL value). */
|
|
12
|
+
declare const toGenreUuid: (value: string | null) => (string & z.core.$brand<"GenreUuid">) | null;
|
|
13
|
+
/** The id as an `ArtistUuid`, or null when it is absent or malformed (e.g. a raw URL value). */
|
|
14
|
+
declare const toArtistUuid: (value: string | null) => (string & z.core.$brand<"ArtistUuid">) | null;
|
|
15
|
+
/** The id as a `SongUuid`, or null when it is absent or malformed (e.g. a raw URL value). */
|
|
16
|
+
declare const toSongUuid: (value: string | null) => (string & z.core.$brand<"SongUuid">) | null;
|
|
17
|
+
|
|
18
|
+
export { type ArtistUuid as A, type GenrePlaylistUuid as G, type SongUuid as S, ArtistUuidSchema as a, GenrePlaylistUuidSchema as b, type GenreUuid as c, GenreUuidSchema as d, SongUuidSchema as e, toGenreUuid as f, toSongUuid as g, toArtistUuid as t };
|