@ansango/lastfm-api 3.3.0 → 3.5.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/CHANGELOG.md +25 -0
- package/README.md +189 -3
- package/dist/client.d.ts +9 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -1
- package/dist/client.js.map +1 -1
- package/dist/core/canonical-methods.d.ts +25 -0
- package/dist/core/canonical-methods.d.ts.map +1 -0
- package/dist/core/canonical-methods.js +88 -0
- package/dist/core/canonical-methods.js.map +1 -0
- package/dist/core/client.d.ts +33 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +48 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/pagination.d.ts +59 -0
- package/dist/core/pagination.d.ts.map +1 -0
- package/dist/core/pagination.js +93 -0
- package/dist/core/pagination.js.map +1 -0
- package/dist/core/schemas/album.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/album.schemas.js +1 -1
- package/dist/core/schemas/album.schemas.js.map +1 -0
- package/dist/core/schemas/artist.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/artist.schemas.js +1 -1
- package/dist/core/schemas/artist.schemas.js.map +1 -0
- package/dist/core/schemas/auth.schemas.d.ts.map +1 -0
- package/dist/core/schemas/auth.schemas.js.map +1 -0
- package/dist/core/schemas/base/base.entities.schemas.d.ts.map +1 -0
- package/dist/core/schemas/base/base.entities.schemas.js.map +1 -0
- package/dist/core/schemas/base/base.entity-names.schemas.d.ts.map +1 -0
- package/dist/core/schemas/base/base.entity-names.schemas.js.map +1 -0
- package/dist/core/schemas/base/base.metadata.schemas.d.ts.map +1 -0
- package/dist/core/schemas/base/base.metadata.schemas.js.map +1 -0
- package/dist/core/schemas/base/base.pagination.schemas.d.ts.map +1 -0
- package/dist/core/schemas/base/base.pagination.schemas.js.map +1 -0
- package/dist/core/schemas/base/base.primitives.schemas.d.ts.map +1 -0
- package/dist/core/schemas/base/base.primitives.schemas.js.map +1 -0
- package/dist/core/schemas/base/index.d.ts.map +1 -0
- package/dist/core/schemas/base/index.js.map +1 -0
- package/dist/core/schemas/chart.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/chart.schemas.js +1 -1
- package/dist/core/schemas/chart.schemas.js.map +1 -0
- package/dist/core/schemas/geo.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/geo.schemas.js +1 -1
- package/dist/core/schemas/geo.schemas.js.map +1 -0
- package/dist/{services → core/schemas}/index.d.ts +1 -10
- package/dist/core/schemas/index.d.ts.map +1 -0
- package/dist/core/schemas/index.js +11 -0
- package/dist/core/schemas/index.js.map +1 -0
- package/dist/core/schemas/library.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/library.schemas.js +1 -1
- package/dist/core/schemas/library.schemas.js.map +1 -0
- package/dist/core/schemas/tag.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/tag.schemas.js +1 -1
- package/dist/core/schemas/tag.schemas.js.map +1 -0
- package/dist/core/schemas/track.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/track.schemas.js +1 -1
- package/dist/core/schemas/track.schemas.js.map +1 -0
- package/dist/core/schemas/user.schemas.d.ts.map +1 -0
- package/dist/{services → core/schemas}/user.schemas.js +1 -1
- package/dist/core/schemas/user.schemas.js.map +1 -0
- package/dist/{services → core/services}/album.d.ts +2 -2
- package/dist/core/services/album.d.ts.map +1 -0
- package/dist/{services → core/services}/album.js +1 -1
- package/dist/core/services/album.js.map +1 -0
- package/dist/{services → core/services}/artist.d.ts +2 -2
- package/dist/core/services/artist.d.ts.map +1 -0
- package/dist/{services → core/services}/artist.js +1 -1
- package/dist/core/services/artist.js.map +1 -0
- package/dist/{services → core/services}/auth.d.ts +2 -2
- package/dist/core/services/auth.d.ts.map +1 -0
- package/dist/{services → core/services}/auth.js +1 -1
- package/dist/core/services/auth.js.map +1 -0
- package/dist/{services → core/services}/chart.d.ts +2 -2
- package/dist/core/services/chart.d.ts.map +1 -0
- package/dist/{services → core/services}/chart.js +1 -1
- package/dist/core/services/chart.js.map +1 -0
- package/dist/{services → core/services}/geo.d.ts +2 -2
- package/dist/core/services/geo.d.ts.map +1 -0
- package/dist/{services → core/services}/geo.js +1 -1
- package/dist/core/services/geo.js.map +1 -0
- package/dist/core/services/index.d.ts +10 -0
- package/dist/core/services/index.d.ts.map +1 -0
- package/dist/core/services/index.js +10 -0
- package/dist/core/services/index.js.map +1 -0
- package/dist/{services → core/services}/library.d.ts +2 -2
- package/dist/core/services/library.d.ts.map +1 -0
- package/dist/{services → core/services}/library.js +1 -1
- package/dist/core/services/library.js.map +1 -0
- package/dist/{services → core/services}/tag.d.ts +2 -2
- package/dist/core/services/tag.d.ts.map +1 -0
- package/dist/{services → core/services}/tag.js +1 -1
- package/dist/core/services/tag.js.map +1 -0
- package/dist/{services → core/services}/track.d.ts +2 -2
- package/dist/core/services/track.d.ts.map +1 -0
- package/dist/{services → core/services}/track.js +1 -1
- package/dist/core/services/track.js.map +1 -0
- package/dist/{services → core/services}/track.utils.d.ts +2 -2
- package/dist/core/services/track.utils.d.ts.map +1 -0
- package/dist/core/services/track.utils.js.map +1 -0
- package/dist/{services → core/services}/user.d.ts +2 -2
- package/dist/core/services/user.d.ts.map +1 -0
- package/dist/{services → core/services}/user.js +1 -1
- package/dist/core/services/user.js.map +1 -0
- package/dist/entrypoints/album.d.ts +3 -3
- package/dist/entrypoints/album.d.ts.map +1 -1
- package/dist/entrypoints/album.js +2 -2
- package/dist/entrypoints/album.js.map +1 -1
- package/dist/entrypoints/album.schemas.d.ts +2 -1
- package/dist/entrypoints/album.schemas.d.ts.map +1 -1
- package/dist/entrypoints/album.schemas.js +1 -2
- package/dist/entrypoints/album.schemas.js.map +1 -1
- package/dist/entrypoints/artist.d.ts +3 -3
- package/dist/entrypoints/artist.d.ts.map +1 -1
- package/dist/entrypoints/artist.js +2 -2
- package/dist/entrypoints/artist.js.map +1 -1
- package/dist/entrypoints/artist.schemas.d.ts +2 -1
- package/dist/entrypoints/artist.schemas.d.ts.map +1 -1
- package/dist/entrypoints/artist.schemas.js +1 -2
- package/dist/entrypoints/artist.schemas.js.map +1 -1
- package/dist/entrypoints/auth.d.ts +3 -3
- package/dist/entrypoints/auth.d.ts.map +1 -1
- package/dist/entrypoints/auth.js +2 -2
- package/dist/entrypoints/auth.js.map +1 -1
- package/dist/entrypoints/auth.schemas.d.ts +2 -1
- package/dist/entrypoints/auth.schemas.d.ts.map +1 -1
- package/dist/entrypoints/auth.schemas.js +1 -2
- package/dist/entrypoints/auth.schemas.js.map +1 -1
- package/dist/entrypoints/base.schemas.d.ts +2 -1
- package/dist/entrypoints/base.schemas.d.ts.map +1 -1
- package/dist/entrypoints/base.schemas.js +1 -2
- package/dist/entrypoints/base.schemas.js.map +1 -1
- package/dist/entrypoints/chart.d.ts +3 -3
- package/dist/entrypoints/chart.d.ts.map +1 -1
- package/dist/entrypoints/chart.js +2 -2
- package/dist/entrypoints/chart.js.map +1 -1
- package/dist/entrypoints/chart.schemas.d.ts +2 -1
- package/dist/entrypoints/chart.schemas.d.ts.map +1 -1
- package/dist/entrypoints/chart.schemas.js +1 -2
- package/dist/entrypoints/chart.schemas.js.map +1 -1
- package/dist/entrypoints/core.d.ts +5 -0
- package/dist/entrypoints/core.d.ts.map +1 -0
- package/dist/entrypoints/core.js +5 -0
- package/dist/entrypoints/core.js.map +1 -0
- package/dist/entrypoints/core.schemas.d.ts +3 -0
- package/dist/entrypoints/core.schemas.d.ts.map +1 -0
- package/dist/entrypoints/core.schemas.js +2 -0
- package/dist/entrypoints/core.schemas.js.map +1 -0
- package/dist/entrypoints/exporter.d.ts +3 -0
- package/dist/entrypoints/exporter.d.ts.map +1 -0
- package/dist/entrypoints/exporter.js +3 -0
- package/dist/entrypoints/exporter.js.map +1 -0
- package/dist/entrypoints/exporter.schemas.d.ts +3 -0
- package/dist/entrypoints/exporter.schemas.d.ts.map +1 -0
- package/dist/entrypoints/exporter.schemas.js +2 -0
- package/dist/entrypoints/exporter.schemas.js.map +1 -0
- package/dist/entrypoints/geo.d.ts +3 -3
- package/dist/entrypoints/geo.d.ts.map +1 -1
- package/dist/entrypoints/geo.js +2 -2
- package/dist/entrypoints/geo.js.map +1 -1
- package/dist/entrypoints/geo.schemas.d.ts +2 -1
- package/dist/entrypoints/geo.schemas.d.ts.map +1 -1
- package/dist/entrypoints/geo.schemas.js +1 -2
- package/dist/entrypoints/geo.schemas.js.map +1 -1
- package/dist/entrypoints/insights.d.ts +4 -0
- package/dist/entrypoints/insights.d.ts.map +1 -0
- package/dist/entrypoints/insights.js +3 -0
- package/dist/entrypoints/insights.js.map +1 -0
- package/dist/entrypoints/insights.schemas.d.ts +3 -0
- package/dist/entrypoints/insights.schemas.d.ts.map +1 -0
- package/dist/entrypoints/insights.schemas.js +2 -0
- package/dist/entrypoints/insights.schemas.js.map +1 -0
- package/dist/entrypoints/library.d.ts +3 -3
- package/dist/entrypoints/library.d.ts.map +1 -1
- package/dist/entrypoints/library.js +2 -2
- package/dist/entrypoints/library.js.map +1 -1
- package/dist/entrypoints/library.schemas.d.ts +2 -1
- package/dist/entrypoints/library.schemas.d.ts.map +1 -1
- package/dist/entrypoints/library.schemas.js +1 -2
- package/dist/entrypoints/library.schemas.js.map +1 -1
- package/dist/entrypoints/playlists.d.ts +3 -0
- package/dist/entrypoints/playlists.d.ts.map +1 -0
- package/dist/entrypoints/playlists.js +3 -0
- package/dist/entrypoints/playlists.js.map +1 -0
- package/dist/entrypoints/playlists.schemas.d.ts +3 -0
- package/dist/entrypoints/playlists.schemas.d.ts.map +1 -0
- package/dist/entrypoints/playlists.schemas.js +2 -0
- package/dist/entrypoints/playlists.schemas.js.map +1 -0
- package/dist/entrypoints/reports.d.ts +4 -0
- package/dist/entrypoints/reports.d.ts.map +1 -0
- package/dist/entrypoints/reports.js +3 -0
- package/dist/entrypoints/reports.js.map +1 -0
- package/dist/entrypoints/reports.schemas.d.ts +3 -0
- package/dist/entrypoints/reports.schemas.d.ts.map +1 -0
- package/dist/entrypoints/reports.schemas.js +2 -0
- package/dist/entrypoints/reports.schemas.js.map +1 -0
- package/dist/entrypoints/tag.d.ts +3 -3
- package/dist/entrypoints/tag.d.ts.map +1 -1
- package/dist/entrypoints/tag.js +2 -2
- package/dist/entrypoints/tag.js.map +1 -1
- package/dist/entrypoints/tag.schemas.d.ts +2 -1
- package/dist/entrypoints/tag.schemas.d.ts.map +1 -1
- package/dist/entrypoints/tag.schemas.js +1 -2
- package/dist/entrypoints/tag.schemas.js.map +1 -1
- package/dist/entrypoints/track.d.ts +3 -3
- package/dist/entrypoints/track.d.ts.map +1 -1
- package/dist/entrypoints/track.js +2 -2
- package/dist/entrypoints/track.js.map +1 -1
- package/dist/entrypoints/track.schemas.d.ts +2 -1
- package/dist/entrypoints/track.schemas.d.ts.map +1 -1
- package/dist/entrypoints/track.schemas.js +1 -2
- package/dist/entrypoints/track.schemas.js.map +1 -1
- package/dist/entrypoints/user.d.ts +3 -3
- package/dist/entrypoints/user.d.ts.map +1 -1
- package/dist/entrypoints/user.js +2 -2
- package/dist/entrypoints/user.js.map +1 -1
- package/dist/entrypoints/user.schemas.d.ts +2 -1
- package/dist/entrypoints/user.schemas.d.ts.map +1 -1
- package/dist/entrypoints/user.schemas.js +1 -2
- package/dist/entrypoints/user.schemas.js.map +1 -1
- package/dist/exporter/engines/library.d.ts +4 -0
- package/dist/exporter/engines/library.d.ts.map +1 -0
- package/dist/exporter/engines/library.js +34 -0
- package/dist/exporter/engines/library.js.map +1 -0
- package/dist/exporter/engines/loved.d.ts +4 -0
- package/dist/exporter/engines/loved.d.ts.map +1 -0
- package/dist/exporter/engines/loved.js +35 -0
- package/dist/exporter/engines/loved.js.map +1 -0
- package/dist/exporter/engines/scrobbles.d.ts +4 -0
- package/dist/exporter/engines/scrobbles.d.ts.map +1 -0
- package/dist/exporter/engines/scrobbles.js +74 -0
- package/dist/exporter/engines/scrobbles.js.map +1 -0
- package/dist/exporter/formats/csv.d.ts +5 -0
- package/dist/exporter/formats/csv.d.ts.map +1 -0
- package/dist/exporter/formats/csv.js +35 -0
- package/dist/exporter/formats/csv.js.map +1 -0
- package/dist/exporter/formats/jsonl.d.ts +2 -0
- package/dist/exporter/formats/jsonl.d.ts.map +1 -0
- package/dist/exporter/formats/jsonl.js +4 -0
- package/dist/exporter/formats/jsonl.js.map +1 -0
- package/dist/exporter/formats/listenbrainz.d.ts +3 -0
- package/dist/exporter/formats/listenbrainz.d.ts.map +1 -0
- package/dist/exporter/formats/listenbrainz.js +19 -0
- package/dist/exporter/formats/listenbrainz.js.map +1 -0
- package/dist/exporter/index.d.ts +6 -0
- package/dist/exporter/index.d.ts.map +1 -0
- package/dist/exporter/index.js +6 -0
- package/dist/exporter/index.js.map +1 -0
- package/dist/exporter/schemas.d.ts +291 -0
- package/dist/exporter/schemas.d.ts.map +1 -0
- package/dist/exporter/schemas.js +81 -0
- package/dist/exporter/schemas.js.map +1 -0
- package/dist/exporter/service.d.ts +30 -0
- package/dist/exporter/service.d.ts.map +1 -0
- package/dist/exporter/service.js +11 -0
- package/dist/exporter/service.js.map +1 -0
- package/dist/index.d.ts +14 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -15
- package/dist/index.js.map +1 -1
- package/dist/insights/algorithms/album-habits.d.ts +7 -0
- package/dist/insights/algorithms/album-habits.d.ts.map +1 -0
- package/dist/insights/algorithms/album-habits.js +154 -0
- package/dist/insights/algorithms/album-habits.js.map +1 -0
- package/dist/insights/algorithms/binges.d.ts +8 -0
- package/dist/insights/algorithms/binges.d.ts.map +1 -0
- package/dist/insights/algorithms/binges.js +53 -0
- package/dist/insights/algorithms/binges.js.map +1 -0
- package/dist/insights/algorithms/compare.d.ts +8 -0
- package/dist/insights/algorithms/compare.d.ts.map +1 -0
- package/dist/insights/algorithms/compare.js +39 -0
- package/dist/insights/algorithms/compare.js.map +1 -0
- package/dist/insights/algorithms/decay.d.ts +11 -0
- package/dist/insights/algorithms/decay.d.ts.map +1 -0
- package/dist/insights/algorithms/decay.js +154 -0
- package/dist/insights/algorithms/decay.js.map +1 -0
- package/dist/insights/algorithms/discoveries.d.ts +8 -0
- package/dist/insights/algorithms/discoveries.d.ts.map +1 -0
- package/dist/insights/algorithms/discoveries.js +53 -0
- package/dist/insights/algorithms/discoveries.js.map +1 -0
- package/dist/insights/algorithms/genres.d.ts +11 -0
- package/dist/insights/algorithms/genres.d.ts.map +1 -0
- package/dist/insights/algorithms/genres.js +201 -0
- package/dist/insights/algorithms/genres.js.map +1 -0
- package/dist/insights/algorithms/group.d.ts +8 -0
- package/dist/insights/algorithms/group.d.ts.map +1 -0
- package/dist/insights/algorithms/group.js +127 -0
- package/dist/insights/algorithms/group.js.map +1 -0
- package/dist/insights/algorithms/hours.d.ts +8 -0
- package/dist/insights/algorithms/hours.d.ts.map +1 -0
- package/dist/insights/algorithms/hours.js +43 -0
- package/dist/insights/algorithms/hours.js.map +1 -0
- package/dist/insights/algorithms/mood.d.ts +8 -0
- package/dist/insights/algorithms/mood.d.ts.map +1 -0
- package/dist/insights/algorithms/mood.js +53 -0
- package/dist/insights/algorithms/mood.js.map +1 -0
- package/dist/insights/algorithms/now-playing.d.ts +20 -0
- package/dist/insights/algorithms/now-playing.d.ts.map +1 -0
- package/dist/insights/algorithms/now-playing.js +128 -0
- package/dist/insights/algorithms/now-playing.js.map +1 -0
- package/dist/insights/algorithms/obscurity.d.ts +27 -0
- package/dist/insights/algorithms/obscurity.d.ts.map +1 -0
- package/dist/insights/algorithms/obscurity.js +158 -0
- package/dist/insights/algorithms/obscurity.js.map +1 -0
- package/dist/insights/algorithms/personality.d.ts +8 -0
- package/dist/insights/algorithms/personality.d.ts.map +1 -0
- package/dist/insights/algorithms/personality.js +42 -0
- package/dist/insights/algorithms/personality.js.map +1 -0
- package/dist/insights/algorithms/recommendations.d.ts +11 -0
- package/dist/insights/algorithms/recommendations.d.ts.map +1 -0
- package/dist/insights/algorithms/recommendations.js +121 -0
- package/dist/insights/algorithms/recommendations.js.map +1 -0
- package/dist/insights/algorithms/streaks.d.ts +11 -0
- package/dist/insights/algorithms/streaks.d.ts.map +1 -0
- package/dist/insights/algorithms/streaks.js +178 -0
- package/dist/insights/algorithms/streaks.js.map +1 -0
- package/dist/insights/algorithms/summary.d.ts +8 -0
- package/dist/insights/algorithms/summary.d.ts.map +1 -0
- package/dist/insights/algorithms/summary.js +117 -0
- package/dist/insights/algorithms/summary.js.map +1 -0
- package/dist/insights/algorithms/trends.d.ts +8 -0
- package/dist/insights/algorithms/trends.d.ts.map +1 -0
- package/dist/insights/algorithms/trends.js +96 -0
- package/dist/insights/algorithms/trends.js.map +1 -0
- package/dist/insights/index.d.ts +3 -0
- package/dist/insights/index.d.ts.map +1 -0
- package/dist/insights/index.js +3 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/insights/lib/binges.d.ts +31 -0
- package/dist/insights/lib/binges.d.ts.map +1 -0
- package/dist/insights/lib/binges.js +61 -0
- package/dist/insights/lib/binges.js.map +1 -0
- package/dist/insights/lib/compare.d.ts +31 -0
- package/dist/insights/lib/compare.d.ts.map +1 -0
- package/dist/insights/lib/compare.js +68 -0
- package/dist/insights/lib/compare.js.map +1 -0
- package/dist/insights/lib/discoveries.d.ts +17 -0
- package/dist/insights/lib/discoveries.d.ts.map +1 -0
- package/dist/insights/lib/discoveries.js +24 -0
- package/dist/insights/lib/discoveries.js.map +1 -0
- package/dist/insights/lib/diversity.d.ts +28 -0
- package/dist/insights/lib/diversity.d.ts.map +1 -0
- package/dist/insights/lib/diversity.js +39 -0
- package/dist/insights/lib/diversity.js.map +1 -0
- package/dist/insights/lib/hours.d.ts +39 -0
- package/dist/insights/lib/hours.d.ts.map +1 -0
- package/dist/insights/lib/hours.js +66 -0
- package/dist/insights/lib/hours.js.map +1 -0
- package/dist/insights/lib/mood.d.ts +22 -0
- package/dist/insights/lib/mood.d.ts.map +1 -0
- package/dist/insights/lib/mood.js +187 -0
- package/dist/insights/lib/mood.js.map +1 -0
- package/dist/insights/lib/periods.d.ts +17 -0
- package/dist/insights/lib/periods.d.ts.map +1 -0
- package/dist/insights/lib/periods.js +66 -0
- package/dist/insights/lib/periods.js.map +1 -0
- package/dist/insights/lib/personality.d.ts +30 -0
- package/dist/insights/lib/personality.d.ts.map +1 -0
- package/dist/insights/lib/personality.js +131 -0
- package/dist/insights/lib/personality.js.map +1 -0
- package/dist/insights/lib/trends.d.ts +30 -0
- package/dist/insights/lib/trends.d.ts.map +1 -0
- package/dist/insights/lib/trends.js +67 -0
- package/dist/insights/lib/trends.js.map +1 -0
- package/dist/insights/schemas.d.ts +1415 -0
- package/dist/insights/schemas.d.ts.map +1 -0
- package/dist/insights/schemas.js +596 -0
- package/dist/insights/schemas.js.map +1 -0
- package/dist/insights/service.d.ts +191 -0
- package/dist/insights/service.d.ts.map +1 -0
- package/dist/insights/service.js +44 -0
- package/dist/insights/service.js.map +1 -0
- package/dist/playlists/formatters/csv.d.ts +3 -0
- package/dist/playlists/formatters/csv.d.ts.map +1 -0
- package/dist/playlists/formatters/csv.js +18 -0
- package/dist/playlists/formatters/csv.js.map +1 -0
- package/dist/playlists/formatters/m3u.d.ts +3 -0
- package/dist/playlists/formatters/m3u.d.ts.map +1 -0
- package/dist/playlists/formatters/m3u.js +10 -0
- package/dist/playlists/formatters/m3u.js.map +1 -0
- package/dist/playlists/formatters/spotifymatch.d.ts +3 -0
- package/dist/playlists/formatters/spotifymatch.d.ts.map +1 -0
- package/dist/playlists/formatters/spotifymatch.js +4 -0
- package/dist/playlists/formatters/spotifymatch.js.map +1 -0
- package/dist/playlists/generators/generator.d.ts +4 -0
- package/dist/playlists/generators/generator.d.ts.map +1 -0
- package/dist/playlists/generators/generator.js +158 -0
- package/dist/playlists/generators/generator.js.map +1 -0
- package/dist/playlists/index.d.ts +6 -0
- package/dist/playlists/index.d.ts.map +1 -0
- package/dist/playlists/index.js +6 -0
- package/dist/playlists/index.js.map +1 -0
- package/dist/playlists/schemas.d.ts +150 -0
- package/dist/playlists/schemas.d.ts.map +1 -0
- package/dist/playlists/schemas.js +53 -0
- package/dist/playlists/schemas.js.map +1 -0
- package/dist/playlists/service.d.ts +28 -0
- package/dist/playlists/service.d.ts.map +1 -0
- package/dist/playlists/service.js +27 -0
- package/dist/playlists/service.js.map +1 -0
- package/dist/reports/generators/digest.d.ts +4 -0
- package/dist/reports/generators/digest.d.ts.map +1 -0
- package/dist/reports/generators/digest.js +95 -0
- package/dist/reports/generators/digest.js.map +1 -0
- package/dist/reports/generators/milestones.d.ts +4 -0
- package/dist/reports/generators/milestones.d.ts.map +1 -0
- package/dist/reports/generators/milestones.js +59 -0
- package/dist/reports/generators/milestones.js.map +1 -0
- package/dist/reports/generators/wrapped.d.ts +4 -0
- package/dist/reports/generators/wrapped.d.ts.map +1 -0
- package/dist/reports/generators/wrapped.js +179 -0
- package/dist/reports/generators/wrapped.js.map +1 -0
- package/dist/reports/index.d.ts +3 -0
- package/dist/reports/index.d.ts.map +1 -0
- package/dist/reports/index.js +3 -0
- package/dist/reports/index.js.map +1 -0
- package/dist/reports/schemas.d.ts +244 -0
- package/dist/reports/schemas.d.ts.map +1 -0
- package/dist/reports/schemas.js +92 -0
- package/dist/reports/schemas.js.map +1 -0
- package/dist/reports/service.d.ts +30 -0
- package/dist/reports/service.d.ts.map +1 -0
- package/dist/reports/service.js +11 -0
- package/dist/reports/service.js.map +1 -0
- package/package.json +44 -4
- package/dist/services/album.d.ts.map +0 -1
- package/dist/services/album.js.map +0 -1
- package/dist/services/album.schemas.d.ts.map +0 -1
- package/dist/services/album.schemas.js.map +0 -1
- package/dist/services/artist.d.ts.map +0 -1
- package/dist/services/artist.js.map +0 -1
- package/dist/services/artist.schemas.d.ts.map +0 -1
- package/dist/services/artist.schemas.js.map +0 -1
- package/dist/services/auth.d.ts.map +0 -1
- package/dist/services/auth.js.map +0 -1
- package/dist/services/auth.schemas.d.ts.map +0 -1
- package/dist/services/auth.schemas.js.map +0 -1
- package/dist/services/chart.d.ts.map +0 -1
- package/dist/services/chart.js.map +0 -1
- package/dist/services/chart.schemas.d.ts.map +0 -1
- package/dist/services/chart.schemas.js.map +0 -1
- package/dist/services/geo.d.ts.map +0 -1
- package/dist/services/geo.js.map +0 -1
- package/dist/services/geo.schemas.d.ts.map +0 -1
- package/dist/services/geo.schemas.js.map +0 -1
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/index.js +0 -21
- package/dist/services/index.js.map +0 -1
- package/dist/services/library.d.ts.map +0 -1
- package/dist/services/library.js.map +0 -1
- package/dist/services/library.schemas.d.ts.map +0 -1
- package/dist/services/library.schemas.js.map +0 -1
- package/dist/services/schemas/base.entities.schemas.d.ts.map +0 -1
- package/dist/services/schemas/base.entities.schemas.js.map +0 -1
- package/dist/services/schemas/base.entity-names.schemas.d.ts.map +0 -1
- package/dist/services/schemas/base.entity-names.schemas.js.map +0 -1
- package/dist/services/schemas/base.metadata.schemas.d.ts.map +0 -1
- package/dist/services/schemas/base.metadata.schemas.js.map +0 -1
- package/dist/services/schemas/base.pagination.schemas.d.ts.map +0 -1
- package/dist/services/schemas/base.pagination.schemas.js.map +0 -1
- package/dist/services/schemas/base.primitives.schemas.d.ts.map +0 -1
- package/dist/services/schemas/base.primitives.schemas.js.map +0 -1
- package/dist/services/schemas/index.d.ts.map +0 -1
- package/dist/services/schemas/index.js.map +0 -1
- package/dist/services/tag.d.ts.map +0 -1
- package/dist/services/tag.js.map +0 -1
- package/dist/services/tag.schemas.d.ts.map +0 -1
- package/dist/services/tag.schemas.js.map +0 -1
- package/dist/services/track.d.ts.map +0 -1
- package/dist/services/track.js.map +0 -1
- package/dist/services/track.schemas.d.ts.map +0 -1
- package/dist/services/track.schemas.js.map +0 -1
- package/dist/services/track.utils.d.ts.map +0 -1
- package/dist/services/track.utils.js.map +0 -1
- package/dist/services/user.d.ts.map +0 -1
- package/dist/services/user.js.map +0 -1
- package/dist/services/user.schemas.d.ts.map +0 -1
- package/dist/services/user.schemas.js.map +0 -1
- /package/dist/{services → core/schemas}/album.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/artist.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/auth.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/auth.schemas.js +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.entities.schemas.d.ts +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.entities.schemas.js +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.entity-names.schemas.d.ts +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.entity-names.schemas.js +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.metadata.schemas.d.ts +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.metadata.schemas.js +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.pagination.schemas.d.ts +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.pagination.schemas.js +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.primitives.schemas.d.ts +0 -0
- /package/dist/{services/schemas → core/schemas/base}/base.primitives.schemas.js +0 -0
- /package/dist/{services/schemas → core/schemas/base}/index.d.ts +0 -0
- /package/dist/{services/schemas → core/schemas/base}/index.js +0 -0
- /package/dist/{services → core/schemas}/chart.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/geo.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/library.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/tag.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/track.schemas.d.ts +0 -0
- /package/dist/{services → core/schemas}/user.schemas.d.ts +0 -0
- /package/dist/{services → core/services}/track.utils.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
> [ansango/lastfm-api](https://github.com/ansango/lastfm-api). Entries below preserve the
|
|
10
10
|
> historical package and repository names used by their original releases.
|
|
11
11
|
|
|
12
|
+
## [3.4.0] - 2026-08-28
|
|
13
|
+
|
|
14
|
+
### ✨ Features
|
|
15
|
+
|
|
16
|
+
- **insights**: implement compareUsers with Jaccard affinity index (closes #125) ([95f39d6](https://github.com/ansango/lastfm-api/commit/95f39d6))
|
|
17
|
+
- **insights**: implement getMood psychometric classifier and getPersonality archetypes (closes #124) ([0aae0e8](https://github.com/ansango/lastfm-api/commit/0aae0e8))
|
|
18
|
+
- **insights**: implement getTrends ranking diff and getDiscoveries new-artist detector (closes #123) ([1a07234](https://github.com/ansango/lastfm-api/commit/1a07234))
|
|
19
|
+
- **insights**: implement getHoursHistogram and getBinges temporal analytics (closes #122) ([7615ba9](https://github.com/ansango/lastfm-api/commit/7615ba9))
|
|
20
|
+
- **insights**: implement getNowPlaying with artist bio and similarity enrichment (closes #121) ([9de9213](https://github.com/ansango/lastfm-api/commit/9de9213))
|
|
21
|
+
- **insights**: register getSummary route in method registry and Scalar OpenAPI docs ([875bafe](https://github.com/ansango/lastfm-api/commit/875bafe))
|
|
22
|
+
- **insights**: implement getSummary with Shannon diversity index (closes #120) ([28b03b0](https://github.com/ansango/lastfm-api/commit/28b03b0))
|
|
23
|
+
- **insights**: wire insights namespace in method registry ([2d1db4d](https://github.com/ansango/lastfm-api/commit/2d1db4d))
|
|
24
|
+
- **insights**: base architecture, Zod schemas infrastructure, and client wiring (closes #119) ([6ce9d4e](https://github.com/ansango/lastfm-api/commit/6ce9d4e))
|
|
25
|
+
|
|
26
|
+
### 📚 Documentation
|
|
27
|
+
|
|
28
|
+
- **insights**: add dedicated OpenAPI descriptions in Scalar for all 9 insight methods ([1115785](https://github.com/ansango/lastfm-api/commit/1115785))
|
|
29
|
+
- **insights**: documentation, OpenAPI Scalar integration, and CLI migration guide (closes #126) ([f325696](https://github.com/ansango/lastfm-api/commit/f325696))
|
|
30
|
+
|
|
31
|
+
### 🔧 Chores
|
|
32
|
+
|
|
33
|
+
- remove PROJECT_IDEAS.md ([a837c39](https://github.com/ansango/lastfm-api/commit/a837c39))
|
|
34
|
+
- update dependencies and configuration files - Bump @types/node to version 26.4.0 in package.json and bun.lock - Modify build script in package.json to use tsconfig.build.json - Update changelog script to handle undefined tags - Refactor recent tracks test for better readability - Adjust tsconfig files for improved build and development settings - Add tsconfig.build.json for build-specific configurations - Update .gitignore to exclude AGENTS.md ([2a1687f](https://github.com/ansango/lastfm-api/commit/2a1687f))
|
|
35
|
+
|
|
36
|
+
|
|
12
37
|
## [3.3.0] - 2026-08-28
|
|
13
38
|
|
|
14
39
|
### ✨ Features
|
package/README.md
CHANGED
|
@@ -14,7 +14,8 @@ A universal Last.fm API client for Node.js and Browser, written in TypeScript.
|
|
|
14
14
|
## Features
|
|
15
15
|
|
|
16
16
|
- ✅ **Universal**: Works in Node.js (≥20.0.0) and Browser
|
|
17
|
-
- ✅ **Complete coverage**: All
|
|
17
|
+
- ✅ **Complete coverage**: All 56 canonical Last.fm API methods across 9 namespaces
|
|
18
|
+
- ✅ **Insights & Analytics Engine**: 9 high-level derived analytical views (Shannon diversity, enriched Now Playing, diurnal histograms, binge runs, ranking diffs, new discoveries, 2D mood classification, personality archetypes, and Jaccard user comparison)
|
|
18
19
|
- ✅ **TypeScript**: Full type safety with comprehensive type definitions
|
|
19
20
|
- ✅ **Zod Schemas**: Runtime validation schemas for all types
|
|
20
21
|
- ✅ **ESM**: Modern ES modules with tree-shaking support
|
|
@@ -130,7 +131,14 @@ const libraryArtists = await client.library.getArtists({ user: 'ansango' });
|
|
|
130
131
|
// Auth service (for scrobbling and authenticated methods)
|
|
131
132
|
const session = await client.auth.getSession({ token: 'AUTH_TOKEN' });
|
|
132
133
|
// Request an auth token (signed GET, no sk)
|
|
133
|
-
const { token } = await client.auth.getToken();
|
|
134
|
+
const { token, authUrl } = await client.auth.getToken();
|
|
135
|
+
|
|
136
|
+
// Insights & analytics engine
|
|
137
|
+
const summary = await client.insights.getSummary({ user: 'ansango', period: '7day' });
|
|
138
|
+
const nowPlaying = await client.insights.getNowPlaying({ user: 'ansango' });
|
|
139
|
+
const mood = await client.insights.getMood({ user: 'ansango', period: '1month' });
|
|
140
|
+
const personality = await client.insights.getPersonality({ user: 'ansango' });
|
|
141
|
+
const comparison = await client.insights.compareUsers({ userA: 'ansango', userB: 'friend' });
|
|
134
142
|
|
|
135
143
|
// Now-playing and tag/love mutations (all require an authenticated session)
|
|
136
144
|
await client.track.updateNowPlaying({
|
|
@@ -214,6 +222,7 @@ const tracks = await trackService.search({ track: 'Come Together' });
|
|
|
214
222
|
- `@ansango/lastfm-api/geo`
|
|
215
223
|
- `@ansango/lastfm-api/library`
|
|
216
224
|
- `@ansango/lastfm-api/auth`
|
|
225
|
+
- `@ansango/lastfm-api/insights`
|
|
217
226
|
|
|
218
227
|
## Zod Schema Validation
|
|
219
228
|
|
|
@@ -262,8 +271,183 @@ if (result.success) {
|
|
|
262
271
|
- `@ansango/lastfm-api/geo/schemas`
|
|
263
272
|
- `@ansango/lastfm-api/library/schemas`
|
|
264
273
|
- `@ansango/lastfm-api/auth/schemas`
|
|
274
|
+
- `@ansango/lastfm-api/insights/schemas`
|
|
265
275
|
- `@ansango/lastfm-api/schemas` (base types like `imageSchema`, `datePropSchema`, etc.)
|
|
266
276
|
|
|
277
|
+
## Insights & Analytics Engine
|
|
278
|
+
|
|
279
|
+
The package includes a comprehensive, built-in analytics engine providing 20 high-level derived views and statistical metrics computed over Last.fm data:
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
import { createClient } from '@ansango/lastfm-api';
|
|
283
|
+
|
|
284
|
+
const client = createClient();
|
|
285
|
+
|
|
286
|
+
// 1. Summary & Shannon Diversity
|
|
287
|
+
const summary = await client.insights.getSummary({ user: 'ansango', period: '7day' });
|
|
288
|
+
console.log(`Total Scrobbles: ${summary.totalScrobbles}, Normalized Diversity: ${summary.diversity?.normalized}`);
|
|
289
|
+
|
|
290
|
+
// 2. Enriched Now Playing with Artist Biography and Similar Artists
|
|
291
|
+
const nowPlaying = await client.insights.getNowPlaying({ user: 'ansango', similarLimit: 3 });
|
|
292
|
+
|
|
293
|
+
// 3. Diurnal & Weekday Histogram
|
|
294
|
+
const histogram = await client.insights.getHoursHistogram({ user: 'ansango', sinceDays: 30 });
|
|
295
|
+
console.log(`Peak Hour: ${histogram.peakHour}:00, Night Share: ${(histogram.nightShare * 100).toFixed(0)}%`);
|
|
296
|
+
|
|
297
|
+
// 4. Binge Listening Streak Detection
|
|
298
|
+
const binges = await client.insights.getBinges({ user: 'ansango', minLength: 3, maxGapSeconds: 1800 });
|
|
299
|
+
|
|
300
|
+
// 5. Ranking Trends Differentials (Risers, Fallers, Newcomers, Departures)
|
|
301
|
+
const trends = await client.insights.getTrends({
|
|
302
|
+
user: 'ansango',
|
|
303
|
+
target: 'artists',
|
|
304
|
+
currentPeriod: '7day',
|
|
305
|
+
previousPeriod: '1month'
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
// 6. New Artist Discoveries
|
|
309
|
+
const discoveries = await client.insights.getDiscoveries({ user: 'ansango', windowDays: 7 });
|
|
310
|
+
|
|
311
|
+
// 7. 2D Mood Classification (Energy vs. Valence)
|
|
312
|
+
const mood = await client.insights.getMood({ user: 'ansango', period: '1month' });
|
|
313
|
+
console.log(`Mood: ${mood.label} (Energy: ${mood.axes.energy}, Valence: ${mood.axes.valence})`);
|
|
314
|
+
|
|
315
|
+
// 8. Listener Personality Archetype
|
|
316
|
+
const personality = await client.insights.getPersonality({ user: 'ansango' });
|
|
317
|
+
console.log(`Archetype: ${personality.archetype.emoji} ${personality.archetype.name} - ${personality.archetype.blurb}`);
|
|
318
|
+
|
|
319
|
+
// 9. User-to-User Taste Clash (Jaccard Similarity)
|
|
320
|
+
const comparison = await client.insights.compareUsers({ userA: 'ansango', userB: 'friend' });
|
|
321
|
+
console.log(`Taste Compatibility: ${comparison.compatibilityScore}% (Jaccard: ${comparison.jaccard})`);
|
|
322
|
+
|
|
323
|
+
// 10. Obscurity & Hipster Score (Hidden Gems & Mainstream Anchors)
|
|
324
|
+
const obscurity = await client.insights.getObscurityScore({ user: 'ansango', limit: 20 });
|
|
325
|
+
console.log(`Score: ${obscurity.obscurityScore}/100 (${obscurity.category})`);
|
|
326
|
+
|
|
327
|
+
// 11. Forgotten Favorites (Revival Candidates)
|
|
328
|
+
const forgotten = await client.insights.getForgottenFavorites({ user: 'ansango', historicPeriod: '12month', recentPeriod: '1month' });
|
|
329
|
+
|
|
330
|
+
// 12. Listening Obsession Episodes
|
|
331
|
+
const obsessions = await client.insights.getObsessions({ user: 'ansango', windowSize: 20, thresholdRatio: 0.35 });
|
|
332
|
+
|
|
333
|
+
// 13. Consecutive Daily Streaks & Dry Spells
|
|
334
|
+
const streaks = await client.insights.getListeningStreaks({ user: 'ansango' });
|
|
335
|
+
console.log(`Longest Streak: ${streaks.longestStreakDays} days`);
|
|
336
|
+
|
|
337
|
+
// 14. 365-Day Daily Heatmap
|
|
338
|
+
const heatmap = await client.insights.getListeningHeatmap({ user: 'ansango', days: 90 });
|
|
339
|
+
|
|
340
|
+
// 15. Album Habits & Cohesion Score (Album Purist vs Playlist Shuffler)
|
|
341
|
+
const habits = await client.insights.getAlbumHabits({ user: 'ansango', minSessionTracks: 3 });
|
|
342
|
+
console.log(`Cohesion: ${habits.cohesionScore}% (${habits.profile})`);
|
|
343
|
+
|
|
344
|
+
// 16. Genre Breakdown with HHI Concentration Index
|
|
345
|
+
const genres = await client.insights.getGenreBreakdown({ user: 'ansango', period: 'overall' });
|
|
346
|
+
console.log(`Specialization: ${genres.specializationLevel} (HHI: ${genres.hhiIndex})`);
|
|
347
|
+
|
|
348
|
+
// 17. Genre Evolution & Temporal Shifts (Rising, Fading, New)
|
|
349
|
+
const evolution = await client.insights.getGenreEvolution({ user: 'ansango', currentPeriod: '1month', previousPeriod: '12month' });
|
|
350
|
+
|
|
351
|
+
// 18. Smart Similarity Graph Recommendations
|
|
352
|
+
const recs = await client.insights.getSmartRecommendations({ user: 'ansango', seedLimit: 5, limit: 10 });
|
|
353
|
+
|
|
354
|
+
// 19. Bridge Artists Connecting Two Disparate Genres
|
|
355
|
+
const bridges = await client.insights.getBridgeArtists({ tagA: 'post-punk', tagB: 'electronic' });
|
|
356
|
+
|
|
357
|
+
// 20. Multi-User Taste Group Comparison (Consensus & Outlier Detection)
|
|
358
|
+
const group = await client.insights.compareTasteGroup({ users: ['alice', 'bob', 'carol'], period: 'overall' });
|
|
359
|
+
console.log(`Group Average Compatibility: ${group.groupAverageCompatibility}%`);
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Reports & Wrapped Engine
|
|
363
|
+
|
|
364
|
+
Generate shareable annual recaps, historical milestones, and monthly digests:
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
import { createClient } from '@ansango/lastfm-api';
|
|
368
|
+
|
|
369
|
+
const client = createClient();
|
|
370
|
+
|
|
371
|
+
// 1. Year in Review / Wrapped
|
|
372
|
+
const wrapped = await client.reports.getWrapped({ user: 'ansango', year: 2024 });
|
|
373
|
+
console.log(`Top Artist of the Year: ${wrapped.topArtists[0].name}`);
|
|
374
|
+
console.log(`Summer Anthem: ${wrapped.seasons.summer.topTrack} by ${wrapped.seasons.summer.topArtist}`);
|
|
375
|
+
console.log(`Busiest Day: ${wrapped.busiestDay.date} (${wrapped.busiestDay.scrobbles} plays)`);
|
|
376
|
+
|
|
377
|
+
// 2. Scrobble Milestones Tracker & Projection
|
|
378
|
+
const milestones = await client.reports.getMilestones({ user: 'ansango', targets: [1000, 5000, 10000, 50000] });
|
|
379
|
+
console.log(`Next milestone: ${milestones.nextMilestone.target} scrobbles (ETA: ${milestones.nextMilestone.projectedDate})`);
|
|
380
|
+
|
|
381
|
+
// 3. Monthly Comparative Digest
|
|
382
|
+
const digest = await client.reports.getMonthlyDigest({ user: 'ansango', year: 2024, month: 2 });
|
|
383
|
+
console.log(`Growth vs previous month: ${digest.growthPercentage}%`);
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
## Smart Playlists Generator
|
|
387
|
+
|
|
388
|
+
Algorithmic playlist creation with direct export to standard formats:
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
import { createClient } from '@ansango/lastfm-api';
|
|
392
|
+
|
|
393
|
+
const client = createClient();
|
|
394
|
+
|
|
395
|
+
// Generate smart playlist (time-capsule, deep-cuts, heavy-rotation, discovery-radar)
|
|
396
|
+
const playlist = await client.playlists.generate({
|
|
397
|
+
user: 'ansango',
|
|
398
|
+
mode: 'time-capsule',
|
|
399
|
+
limit: 25,
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
// Pre-rendered standard formats:
|
|
403
|
+
console.log(playlist.formats.m3u); // Standard #EXTM3U playlist file content
|
|
404
|
+
console.log(playlist.formats.csv); // CSV spreadsheet
|
|
405
|
+
console.log(playlist.formats.spotifyQueries); // Spotify search query list
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## Bulk Data Exporter & Backup
|
|
409
|
+
|
|
410
|
+
Resilient scrobble history export with checkpointing and multiple output formats:
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
import { createClient } from '@ansango/lastfm-api';
|
|
414
|
+
|
|
415
|
+
const client = createClient();
|
|
416
|
+
|
|
417
|
+
// Export scrobbles with ListenBrainz / JSONL / CSV formatting & checkpointing
|
|
418
|
+
const exportData = await client.exporter.exportScrobbles({
|
|
419
|
+
user: 'ansango',
|
|
420
|
+
format: 'listenbrainz', // 'json' | 'jsonl' | 'csv' | 'listenbrainz'
|
|
421
|
+
limit: 1000,
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// Resumable checkpoint timestamp
|
|
425
|
+
console.log(`Resume from: ${exportData.nextCheckpointUts}`);
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
## Async Pagination & Streaming Iterators
|
|
429
|
+
|
|
430
|
+
Stream large Last.fm datasets seamlessly using standard `for await` loops:
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
import { createClient, iterateItems } from '@ansango/lastfm-api';
|
|
434
|
+
|
|
435
|
+
const client = createClient();
|
|
436
|
+
|
|
437
|
+
for await (const track of iterateItems(
|
|
438
|
+
(params) => client.user.getRecentTracks(params),
|
|
439
|
+
(res) => ({
|
|
440
|
+
items: res.recenttracks?.track ?? [],
|
|
441
|
+
totalPages: Number(res.recenttracks?.['@attr']?.totalPages ?? 1),
|
|
442
|
+
currentPage: Number(res.recenttracks?.['@attr']?.page ?? 1),
|
|
443
|
+
}),
|
|
444
|
+
{ user: 'ansango', limit: 200 },
|
|
445
|
+
{ maxItems: 1000 }
|
|
446
|
+
)) {
|
|
447
|
+
console.log(`${track.name} - ${track.artist['#text']}`);
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
267
451
|
## Environment Variables
|
|
268
452
|
|
|
269
453
|
In Node.js environments, the client automatically loads configuration from environment variables:
|
|
@@ -425,6 +609,7 @@ class LastFmClient {
|
|
|
425
609
|
geo: GeoService;
|
|
426
610
|
library: LibraryService;
|
|
427
611
|
auth: AuthService;
|
|
612
|
+
insights: InsightsService;
|
|
428
613
|
|
|
429
614
|
constructor(config?: Partial<LastFmConfig>);
|
|
430
615
|
getConfig(): Readonly<LastFmConfig>;
|
|
@@ -450,7 +635,7 @@ function resetGlobalConfig(): void;
|
|
|
450
635
|
|
|
451
636
|
### Services
|
|
452
637
|
|
|
453
|
-
The package covers all
|
|
638
|
+
The package covers all 56 canonical Last.fm API methods across 9 namespaces, plus 9 derived analytical methods in the `InsightsService`. See [docs/api-coverage.md](docs/api-coverage.md) for the full table.
|
|
454
639
|
|
|
455
640
|
- **UserService**: 13 methods — `getInfo`, `getFriends`, `getLovedTracks`, `getRecentTracks`, `getTopAlbums`, `getTopArtists`, `getTopTags`, `getTopTracks`, `getWeeklyAlbumChart`, `getWeeklyArtistChart`, `getWeeklyChartList`, `getWeeklyTrackChart`, `getPersonalTags`
|
|
456
641
|
- **AlbumService**: 6 methods — `getInfo`, `getTags`, `getTopTags`, `search`, `addTags`¹, `removeTag`¹
|
|
@@ -461,6 +646,7 @@ The package covers all 57 canonical Last.fm API methods across 9 namespaces. See
|
|
|
461
646
|
- **GeoService**: 2 methods — `getTopArtists`, `getTopTracks`
|
|
462
647
|
- **LibraryService**: 1 method — `getArtists`
|
|
463
648
|
- **AuthService**: 2 methods — `getSession`, `getToken` (removed `getMobileSession` in v4.0.0)
|
|
649
|
+
- **InsightsService**: 9 methods — `getSummary`, `getNowPlaying`, `getHoursHistogram`, `getBinges`, `getTrends`, `getDiscoveries`, `getMood`, `getPersonality`, `compareUsers`
|
|
464
650
|
|
|
465
651
|
¹ Requires an authenticated session.
|
|
466
652
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { LastFmConfig } from './config.js';
|
|
2
|
-
import { type AlbumService, type ArtistService, type AuthService, type ChartService, type GeoService, type LibraryService, type TagService, type TrackService, type UserService } from './services/index.js';
|
|
2
|
+
import { type AlbumService, type ArtistService, type AuthService, type ChartService, type GeoService, type LibraryService, type TagService, type TrackService, type UserService } from './core/services/index.js';
|
|
3
|
+
import { type ExporterService } from './exporter/index.js';
|
|
4
|
+
import { type InsightsService } from './insights/index.js';
|
|
5
|
+
import { type PlaylistsService } from './playlists/index.js';
|
|
6
|
+
import { type ReportsService } from './reports/index.js';
|
|
3
7
|
/**
|
|
4
8
|
* Last.fm API Client
|
|
5
9
|
*
|
|
@@ -29,6 +33,10 @@ export declare class LastFmClient {
|
|
|
29
33
|
readonly geo: GeoService;
|
|
30
34
|
readonly library: LibraryService;
|
|
31
35
|
readonly auth: AuthService;
|
|
36
|
+
readonly insights: InsightsService;
|
|
37
|
+
readonly reports: ReportsService;
|
|
38
|
+
readonly playlists: PlaylistsService;
|
|
39
|
+
readonly exporter: ExporterService;
|
|
32
40
|
private readonly config;
|
|
33
41
|
constructor(config?: Partial<LastFmConfig>);
|
|
34
42
|
/**
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EAUjB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EAUjB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAwB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,YAAY;IACxB,SAAgB,IAAI,EAAE,WAAW,CAAA;IACjC,SAAgB,KAAK,EAAE,YAAY,CAAA;IACnC,SAAgB,MAAM,EAAE,aAAa,CAAA;IACrC,SAAgB,KAAK,EAAE,YAAY,CAAA;IACnC,SAAgB,GAAG,EAAE,UAAU,CAAA;IAC/B,SAAgB,KAAK,EAAE,YAAY,CAAA;IACnC,SAAgB,GAAG,EAAE,UAAU,CAAA;IAC/B,SAAgB,OAAO,EAAE,cAAc,CAAA;IACvC,SAAgB,IAAI,EAAE,WAAW,CAAA;IACjC,SAAgB,QAAQ,EAAE,eAAe,CAAA;IACzC,SAAgB,OAAO,EAAE,cAAc,CAAA;IACvC,SAAgB,SAAS,EAAE,gBAAgB,CAAA;IAC3C,SAAgB,QAAQ,EAAE,eAAe,CAAA;IAEzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;IAmB1C;;OAEG;IACH,SAAS,IAAI,QAAQ,CAAC,YAAY,CAAC;CAGnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAEzE"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { createConfig, getGlobalConfig } from './config.js';
|
|
2
|
-
import { createAlbumService, createArtistService, createAuthService, createChartService, createGeoService, createLibraryService, createTagService, createTrackService, createUserService, } from './services/index.js';
|
|
2
|
+
import { createAlbumService, createArtistService, createAuthService, createChartService, createGeoService, createLibraryService, createTagService, createTrackService, createUserService, } from './core/services/index.js';
|
|
3
|
+
import { createExporterService } from './exporter/index.js';
|
|
4
|
+
import { createInsightsService } from './insights/index.js';
|
|
5
|
+
import { createPlaylistsService } from './playlists/index.js';
|
|
6
|
+
import { createReportsService } from './reports/index.js';
|
|
3
7
|
/**
|
|
4
8
|
* Last.fm API Client
|
|
5
9
|
*
|
|
@@ -29,6 +33,10 @@ export class LastFmClient {
|
|
|
29
33
|
geo;
|
|
30
34
|
library;
|
|
31
35
|
auth;
|
|
36
|
+
insights;
|
|
37
|
+
reports;
|
|
38
|
+
playlists;
|
|
39
|
+
exporter;
|
|
32
40
|
config;
|
|
33
41
|
constructor(config) {
|
|
34
42
|
this.config = config ? createConfig(config) : getGlobalConfig();
|
|
@@ -42,6 +50,10 @@ export class LastFmClient {
|
|
|
42
50
|
this.geo = createGeoService(this.config);
|
|
43
51
|
this.library = createLibraryService(this.config);
|
|
44
52
|
this.auth = createAuthService(this.config);
|
|
53
|
+
this.insights = createInsightsService(this.config);
|
|
54
|
+
this.reports = createReportsService(this.config);
|
|
55
|
+
this.playlists = createPlaylistsService(this.config);
|
|
56
|
+
this.exporter = createExporterService(this.config);
|
|
45
57
|
}
|
|
46
58
|
/**
|
|
47
59
|
* Get the current configuration (read-only)
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EAKN,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAMjB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EAKN,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAMjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,qBAAqB,CAAA;AACjF,OAAO,EAAE,qBAAqB,EAAwB,MAAM,qBAAqB,CAAA;AACjF,OAAO,EAAE,sBAAsB,EAAyB,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,oBAAoB,EAAuB,MAAM,oBAAoB,CAAA;AAE9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,YAAY;IACR,IAAI,CAAa;IACjB,KAAK,CAAc;IACnB,MAAM,CAAe;IACrB,KAAK,CAAc;IACnB,GAAG,CAAY;IACf,KAAK,CAAc;IACnB,GAAG,CAAY;IACf,OAAO,CAAgB;IACvB,IAAI,CAAa;IACjB,QAAQ,CAAiB;IACzB,OAAO,CAAgB;IACvB,SAAS,CAAkB;IAC3B,QAAQ,CAAiB;IAExB,MAAM,CAAc;IAErC,YAAY,MAA8B;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;QAE/D,0BAA0B;QAC1B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC1C,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC9C,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACxC,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACxC,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAChD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC1C,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAClD,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAChD,IAAI,CAAC,SAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACpD,IAAI,CAAC,QAAQ,GAAG,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnD,CAAC;IAED;;OAEG;IACH,SAAS;QACR,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;IAC1B,CAAC;CACD;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,MAA8B;IAC1D,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Last.fm method inventory.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the "56/56" coverage of the Last.fm API.
|
|
5
|
+
* (was 57/57; `auth.getMobileSession` removed in v4.0.0 — see #117.)
|
|
6
|
+
* Consumed by:
|
|
7
|
+
* - `src/__tests__/inventory.test.ts` — verifies that each method exists on the client
|
|
8
|
+
* - `src/method-registry.ts` — wires the docs tool (Hono + Scalar)
|
|
9
|
+
*
|
|
10
|
+
* Rules:
|
|
11
|
+
* - Only canonical Last.fm `namespace.method` pairs go here.
|
|
12
|
+
* - Wrapper/alias methods (e.g. `scrobbleMany`, `postTrackScrobble`,
|
|
13
|
+
* `postBatchTrackScrobble`) are excluded because they all target the
|
|
14
|
+
* same canonical endpoint (`track.scrobble`) and must not be
|
|
15
|
+
* double-counted.
|
|
16
|
+
*
|
|
17
|
+
* The per-namespace breakdown:
|
|
18
|
+
* - artist (10), album (6), track (12), user (13), tag (7),
|
|
19
|
+
* chart (3), geo (2), library (1), auth (3) = 57
|
|
20
|
+
*/
|
|
21
|
+
export declare const CANONICAL_METHODS: readonly ["artist.getInfo", "artist.getTags", "artist.getSimilar", "artist.getTopTags", "artist.getTopAlbums", "artist.getTopTracks", "artist.search", "artist.getCorrection", "artist.addTags", "artist.removeTag", "album.getInfo", "album.getTags", "album.getTopTags", "album.search", "album.addTags", "album.removeTag", "track.getInfo", "track.getSimilar", "track.getTags", "track.getTopTags", "track.search", "track.getCorrection", "track.addTags", "track.removeTag", "track.love", "track.unlove", "track.updateNowPlaying", "track.scrobble", "user.getInfo", "user.getFriends", "user.getLovedTracks", "user.getRecentTracks", "user.getTopAlbums", "user.getTopArtists", "user.getTopTags", "user.getTopTracks", "user.getWeeklyAlbumChart", "user.getWeeklyArtistChart", "user.getWeeklyChartList", "user.getWeeklyTrackChart", "user.getPersonalTags", "tag.getInfo", "tag.getSimilar", "tag.getTopAlbums", "tag.getTopArtists", "tag.getTopTags", "tag.getTopTracks", "tag.getWeeklyChartList", "chart.getTopArtists", "chart.getTopTags", "chart.getTopTracks", "geo.getTopArtists", "geo.getTopTracks", "library.getArtists", "auth.getSession", "auth.getToken"];
|
|
22
|
+
export type CanonicalMethodId = (typeof CANONICAL_METHODS)[number];
|
|
23
|
+
export type CanonicalMethod = CanonicalMethodId;
|
|
24
|
+
export type Namespace = CanonicalMethodId extends `${infer N}.${string}` ? N : never;
|
|
25
|
+
//# sourceMappingURL=canonical-methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-methods.d.ts","sourceRoot":"","sources":["../../src/core/canonical-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iBAAiB,0nCAkEpB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAClE,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAC/C,MAAM,MAAM,SAAS,GAAG,iBAAiB,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Last.fm method inventory.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the "56/56" coverage of the Last.fm API.
|
|
5
|
+
* (was 57/57; `auth.getMobileSession` removed in v4.0.0 — see #117.)
|
|
6
|
+
* Consumed by:
|
|
7
|
+
* - `src/__tests__/inventory.test.ts` — verifies that each method exists on the client
|
|
8
|
+
* - `src/method-registry.ts` — wires the docs tool (Hono + Scalar)
|
|
9
|
+
*
|
|
10
|
+
* Rules:
|
|
11
|
+
* - Only canonical Last.fm `namespace.method` pairs go here.
|
|
12
|
+
* - Wrapper/alias methods (e.g. `scrobbleMany`, `postTrackScrobble`,
|
|
13
|
+
* `postBatchTrackScrobble`) are excluded because they all target the
|
|
14
|
+
* same canonical endpoint (`track.scrobble`) and must not be
|
|
15
|
+
* double-counted.
|
|
16
|
+
*
|
|
17
|
+
* The per-namespace breakdown:
|
|
18
|
+
* - artist (10), album (6), track (12), user (13), tag (7),
|
|
19
|
+
* chart (3), geo (2), library (1), auth (3) = 57
|
|
20
|
+
*/
|
|
21
|
+
export const CANONICAL_METHODS = [
|
|
22
|
+
// artist (10)
|
|
23
|
+
'artist.getInfo',
|
|
24
|
+
'artist.getTags',
|
|
25
|
+
'artist.getSimilar',
|
|
26
|
+
'artist.getTopTags',
|
|
27
|
+
'artist.getTopAlbums',
|
|
28
|
+
'artist.getTopTracks',
|
|
29
|
+
'artist.search',
|
|
30
|
+
'artist.getCorrection',
|
|
31
|
+
'artist.addTags',
|
|
32
|
+
'artist.removeTag',
|
|
33
|
+
// album (6)
|
|
34
|
+
'album.getInfo',
|
|
35
|
+
'album.getTags',
|
|
36
|
+
'album.getTopTags',
|
|
37
|
+
'album.search',
|
|
38
|
+
'album.addTags',
|
|
39
|
+
'album.removeTag',
|
|
40
|
+
// track (12)
|
|
41
|
+
'track.getInfo',
|
|
42
|
+
'track.getSimilar',
|
|
43
|
+
'track.getTags',
|
|
44
|
+
'track.getTopTags',
|
|
45
|
+
'track.search',
|
|
46
|
+
'track.getCorrection',
|
|
47
|
+
'track.addTags',
|
|
48
|
+
'track.removeTag',
|
|
49
|
+
'track.love',
|
|
50
|
+
'track.unlove',
|
|
51
|
+
'track.updateNowPlaying',
|
|
52
|
+
'track.scrobble',
|
|
53
|
+
// user (13)
|
|
54
|
+
'user.getInfo',
|
|
55
|
+
'user.getFriends',
|
|
56
|
+
'user.getLovedTracks',
|
|
57
|
+
'user.getRecentTracks',
|
|
58
|
+
'user.getTopAlbums',
|
|
59
|
+
'user.getTopArtists',
|
|
60
|
+
'user.getTopTags',
|
|
61
|
+
'user.getTopTracks',
|
|
62
|
+
'user.getWeeklyAlbumChart',
|
|
63
|
+
'user.getWeeklyArtistChart',
|
|
64
|
+
'user.getWeeklyChartList',
|
|
65
|
+
'user.getWeeklyTrackChart',
|
|
66
|
+
'user.getPersonalTags',
|
|
67
|
+
// tag (7)
|
|
68
|
+
'tag.getInfo',
|
|
69
|
+
'tag.getSimilar',
|
|
70
|
+
'tag.getTopAlbums',
|
|
71
|
+
'tag.getTopArtists',
|
|
72
|
+
'tag.getTopTags',
|
|
73
|
+
'tag.getTopTracks',
|
|
74
|
+
'tag.getWeeklyChartList',
|
|
75
|
+
// chart (3)
|
|
76
|
+
'chart.getTopArtists',
|
|
77
|
+
'chart.getTopTags',
|
|
78
|
+
'chart.getTopTracks',
|
|
79
|
+
// geo (2)
|
|
80
|
+
'geo.getTopArtists',
|
|
81
|
+
'geo.getTopTracks',
|
|
82
|
+
// library (1)
|
|
83
|
+
'library.getArtists',
|
|
84
|
+
// auth (2)
|
|
85
|
+
'auth.getSession',
|
|
86
|
+
'auth.getToken',
|
|
87
|
+
];
|
|
88
|
+
//# sourceMappingURL=canonical-methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonical-methods.js","sourceRoot":"","sources":["../../src/core/canonical-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,eAAe;IACf,sBAAsB;IACtB,gBAAgB;IAChB,kBAAkB;IAClB,YAAY;IACZ,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,iBAAiB;IACjB,aAAa;IACb,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,cAAc;IACd,qBAAqB;IACrB,eAAe;IACf,iBAAiB;IACjB,YAAY;IACZ,cAAc;IACd,wBAAwB;IACxB,gBAAgB;IAChB,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;IACpB,iBAAiB;IACjB,mBAAmB;IACnB,0BAA0B;IAC1B,2BAA2B;IAC3B,yBAAyB;IACzB,0BAA0B;IAC1B,sBAAsB;IACtB,UAAU;IACV,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,gBAAgB;IAChB,kBAAkB;IAClB,wBAAwB;IACxB,YAAY;IACZ,qBAAqB;IACrB,kBAAkB;IAClB,oBAAoB;IACpB,UAAU;IACV,mBAAmB;IACnB,kBAAkB;IAClB,cAAc;IACd,oBAAoB;IACpB,WAAW;IACX,iBAAiB;IACjB,eAAe;CACN,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type LastFmConfig } from '../config.js';
|
|
2
|
+
import { type AlbumService, type ArtistService, type AuthService, type ChartService, type GeoService, type LibraryService, type TagService, type TrackService, type UserService } from './services/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Lightweight Last.fm Core API client.
|
|
5
|
+
*
|
|
6
|
+
* Provides access strictly to the 56 canonical Last.fm REST API methods
|
|
7
|
+
* across the 9 official namespaces.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LastFmCoreClient {
|
|
10
|
+
readonly user: UserService;
|
|
11
|
+
readonly album: AlbumService;
|
|
12
|
+
readonly artist: ArtistService;
|
|
13
|
+
readonly track: TrackService;
|
|
14
|
+
readonly tag: TagService;
|
|
15
|
+
readonly chart: ChartService;
|
|
16
|
+
readonly geo: GeoService;
|
|
17
|
+
readonly library: LibraryService;
|
|
18
|
+
readonly auth: AuthService;
|
|
19
|
+
private readonly config;
|
|
20
|
+
constructor(config?: Partial<LastFmConfig>);
|
|
21
|
+
/**
|
|
22
|
+
* Get the current configuration (read-only)
|
|
23
|
+
*/
|
|
24
|
+
getConfig(): Readonly<LastFmConfig>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Helper function to create a Last.fm core client instance
|
|
28
|
+
*
|
|
29
|
+
* @param config - Optional configuration. If not provided, uses global config.
|
|
30
|
+
* @returns A new LastFmCoreClient instance
|
|
31
|
+
*/
|
|
32
|
+
export declare function createCoreClient(config?: Partial<LastFmConfig>): LastFmCoreClient;
|
|
33
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC/E,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EAUjB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,MAAM,qBAAqB,CAAA;AAE5B;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC5B,SAAgB,IAAI,EAAE,WAAW,CAAA;IACjC,SAAgB,KAAK,EAAE,YAAY,CAAA;IACnC,SAAgB,MAAM,EAAE,aAAa,CAAA;IACrC,SAAgB,KAAK,EAAE,YAAY,CAAA;IACnC,SAAgB,GAAG,EAAE,UAAU,CAAA;IAC/B,SAAgB,KAAK,EAAE,YAAY,CAAA;IACnC,SAAgB,GAAG,EAAE,UAAU,CAAA;IAC/B,SAAgB,OAAO,EAAE,cAAc,CAAA;IACvC,SAAgB,IAAI,EAAE,WAAW,CAAA;IAEjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;IAc1C;;OAEG;IACH,SAAS,IAAI,QAAQ,CAAC,YAAY,CAAC;CAGnC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,gBAAgB,CAEjF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createConfig, getGlobalConfig } from '../config.js';
|
|
2
|
+
import { createAlbumService, createArtistService, createAuthService, createChartService, createGeoService, createLibraryService, createTagService, createTrackService, createUserService, } from './services/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Lightweight Last.fm Core API client.
|
|
5
|
+
*
|
|
6
|
+
* Provides access strictly to the 56 canonical Last.fm REST API methods
|
|
7
|
+
* across the 9 official namespaces.
|
|
8
|
+
*/
|
|
9
|
+
export class LastFmCoreClient {
|
|
10
|
+
user;
|
|
11
|
+
album;
|
|
12
|
+
artist;
|
|
13
|
+
track;
|
|
14
|
+
tag;
|
|
15
|
+
chart;
|
|
16
|
+
geo;
|
|
17
|
+
library;
|
|
18
|
+
auth;
|
|
19
|
+
config;
|
|
20
|
+
constructor(config) {
|
|
21
|
+
this.config = config ? createConfig(config) : getGlobalConfig();
|
|
22
|
+
this.user = createUserService(this.config);
|
|
23
|
+
this.album = createAlbumService(this.config);
|
|
24
|
+
this.artist = createArtistService(this.config);
|
|
25
|
+
this.track = createTrackService(this.config);
|
|
26
|
+
this.tag = createTagService(this.config);
|
|
27
|
+
this.chart = createChartService(this.config);
|
|
28
|
+
this.geo = createGeoService(this.config);
|
|
29
|
+
this.library = createLibraryService(this.config);
|
|
30
|
+
this.auth = createAuthService(this.config);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the current configuration (read-only)
|
|
34
|
+
*/
|
|
35
|
+
getConfig() {
|
|
36
|
+
return { ...this.config };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Helper function to create a Last.fm core client instance
|
|
41
|
+
*
|
|
42
|
+
* @param config - Optional configuration. If not provided, uses global config.
|
|
43
|
+
* @returns A new LastFmCoreClient instance
|
|
44
|
+
*/
|
|
45
|
+
export function createCoreClient(config) {
|
|
46
|
+
return new LastFmCoreClient(config);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAqB,MAAM,cAAc,CAAA;AAC/E,OAAO,EAKN,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAMjB,MAAM,qBAAqB,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IACZ,IAAI,CAAa;IACjB,KAAK,CAAc;IACnB,MAAM,CAAe;IACrB,KAAK,CAAc;IACnB,GAAG,CAAY;IACf,KAAK,CAAc;IACnB,GAAG,CAAY;IACf,OAAO,CAAgB;IACvB,IAAI,CAAa;IAEhB,MAAM,CAAc;IAErC,YAAY,MAA8B;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAA;QAE/D,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC1C,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC9C,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACxC,IAAI,CAAC,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC5C,IAAI,CAAC,GAAG,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACxC,IAAI,CAAC,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAChD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3C,CAAC;IAED;;OAEG;IACH,SAAS;QACR,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;IAC1B,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAA8B;IAC9D,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic pagination and async iterator utilities for Last.fm API endpoints.
|
|
3
|
+
*/
|
|
4
|
+
export interface PaginationOptions {
|
|
5
|
+
/** Starting page number (1-indexed). Defaults to 1. */
|
|
6
|
+
startPage?: number;
|
|
7
|
+
/** Maximum number of pages to fetch. Defaults to Infinity. */
|
|
8
|
+
maxPages?: number;
|
|
9
|
+
/** Maximum total items to yield or collect. Defaults to Infinity. */
|
|
10
|
+
maxItems?: number;
|
|
11
|
+
/** Optional delay in milliseconds between page requests (for gentle rate limiting). Defaults to 0. */
|
|
12
|
+
delayMs?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PageExtraction<TItem> {
|
|
15
|
+
items: TItem[];
|
|
16
|
+
totalPages: number;
|
|
17
|
+
currentPage: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Async generator yielding items across all paginated responses one by one.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* for await (const track of iterateItems(
|
|
25
|
+
* (p) => client.user.getRecentTracks(p),
|
|
26
|
+
* (res) => ({
|
|
27
|
+
* items: res.recenttracks?.track ?? [],
|
|
28
|
+
* totalPages: Number(res.recenttracks?.['@attr']?.totalPages ?? 1),
|
|
29
|
+
* currentPage: Number(res.recenttracks?.['@attr']?.page ?? 1)
|
|
30
|
+
* }),
|
|
31
|
+
* { user: 'ansango', limit: 200 },
|
|
32
|
+
* { maxItems: 1000 }
|
|
33
|
+
* )) {
|
|
34
|
+
* console.log(track.name);
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function iterateItems<TItem, TParams extends Record<string, unknown>, TResponse>(fetchPage: (params: TParams & {
|
|
39
|
+
page: number;
|
|
40
|
+
limit?: number;
|
|
41
|
+
}) => Promise<TResponse>, extract: (response: TResponse) => PageExtraction<TItem>, params: TParams, options?: PaginationOptions): AsyncGenerator<TItem, void, undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* Collects all items from paginated requests into an in-memory array.
|
|
44
|
+
*/
|
|
45
|
+
export declare function collectAll<TItem, TParams extends Record<string, unknown>, TResponse>(fetchPage: (params: TParams & {
|
|
46
|
+
page: number;
|
|
47
|
+
limit?: number;
|
|
48
|
+
}) => Promise<TResponse>, extract: (response: TResponse) => PageExtraction<TItem>, params: TParams, options?: PaginationOptions): Promise<TItem[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Async generator yielding whole page responses one by one.
|
|
51
|
+
*/
|
|
52
|
+
export declare function iteratePages<TParams extends Record<string, unknown>, TResponse>(fetchPage: (params: TParams & {
|
|
53
|
+
page: number;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}) => Promise<TResponse>, extractPagination: (response: TResponse) => {
|
|
56
|
+
totalPages: number;
|
|
57
|
+
currentPage: number;
|
|
58
|
+
}, params: TParams, options?: PaginationOptions): AsyncGenerator<TResponse, void, undefined>;
|
|
59
|
+
//# sourceMappingURL=pagination.d.ts.map
|