@wwdrew/expo-apple-music 1.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/ATTRIBUTION.md +24 -0
- package/LICENSE +190 -0
- package/NOTICE +7 -0
- package/README.md +81 -0
- package/android/build.gradle +26 -0
- package/android/libs/mediaplayback-release-1.1.1.aar +0 -0
- package/android/libs/musickitauth-release-1.1.2.aar +0 -0
- package/android/src/main/AndroidManifest.xml +16 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidCatalogService.kt +86 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidDeveloperToken.kt +39 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidHistoryService.kt +24 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidLibraryMutationsService.kt +30 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidLibraryService.kt +61 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidPlaybackController.kt +484 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidPlaybackObserver.kt +173 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidQueueService.kt +78 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidRatingsService.kt +27 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidRecommendationsService.kt +15 -0
- package/android/src/main/java/expo/modules/applemusic/AndroidSubscriptionService.kt +24 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicErrorCodes.kt +13 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicErrors.kt +46 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicHttpMethod.kt +8 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicJsonMapper.kt +258 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicNativeLoader.kt +32 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicRestJson.kt +40 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicRestQuery.kt +12 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicRestStack.kt +19 -0
- package/android/src/main/java/expo/modules/applemusic/AppleMusicRestTransport.kt +118 -0
- package/android/src/main/java/expo/modules/applemusic/AuthenticatedSession.kt +57 -0
- package/android/src/main/java/expo/modules/applemusic/BridgeResponses.kt +55 -0
- package/android/src/main/java/expo/modules/applemusic/CatalogRestClient.kt +306 -0
- package/android/src/main/java/expo/modules/applemusic/ExpoAppleMusicModule.kt +152 -0
- package/android/src/main/java/expo/modules/applemusic/HistoryRestClient.kt +60 -0
- package/android/src/main/java/expo/modules/applemusic/LibraryIds.kt +6 -0
- package/android/src/main/java/expo/modules/applemusic/LibraryMutationsRestClient.kt +95 -0
- package/android/src/main/java/expo/modules/applemusic/LibraryRestClient.kt +195 -0
- package/android/src/main/java/expo/modules/applemusic/MusicKitAuthContract.kt +78 -0
- package/android/src/main/java/expo/modules/applemusic/MusicKitAuthStorage.kt +76 -0
- package/android/src/main/java/expo/modules/applemusic/MusicKitTokenProvider.kt +13 -0
- package/android/src/main/java/expo/modules/applemusic/PaginationOptions.kt +14 -0
- package/android/src/main/java/expo/modules/applemusic/RatingsRestClient.kt +72 -0
- package/android/src/main/java/expo/modules/applemusic/RecommendationsRestClient.kt +37 -0
- package/android/src/main/java/expo/modules/applemusic/StorefrontRestClient.kt +44 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgeAuth.kt +69 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgeCatalog.kt +76 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgeHistory.kt +35 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgeLibrary.kt +54 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgeLibraryMutations.kt +30 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgePlayer.kt +89 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgeRatings.kt +29 -0
- package/android/src/main/java/expo/modules/applemusic/bridge/ExpoBridgeRecommendations.kt +18 -0
- package/app.plugin.js +1 -0
- package/build/ExpoAppleMusicModule.web.d.ts +15 -0
- package/build/ExpoAppleMusicModule.web.d.ts.map +1 -0
- package/build/ExpoAppleMusicModule.web.js +33 -0
- package/build/ExpoAppleMusicModule.web.js.map +1 -0
- package/build/api/call-native.d.ts +6 -0
- package/build/api/call-native.d.ts.map +1 -0
- package/build/api/call-native.js +35 -0
- package/build/api/call-native.js.map +1 -0
- package/build/api/decode-jwt-exp.d.ts +5 -0
- package/build/api/decode-jwt-exp.d.ts.map +1 -0
- package/build/api/decode-jwt-exp.js +28 -0
- package/build/api/decode-jwt-exp.js.map +1 -0
- package/build/api/library-ids.d.ts +4 -0
- package/build/api/library-ids.d.ts.map +1 -0
- package/build/api/library-ids.js +11 -0
- package/build/api/library-ids.js.map +1 -0
- package/build/api/pagination.d.ts +12 -0
- package/build/api/pagination.d.ts.map +1 -0
- package/build/api/pagination.js +13 -0
- package/build/api/pagination.js.map +1 -0
- package/build/api/parse-authorize-result.d.ts +3 -0
- package/build/api/parse-authorize-result.d.ts.map +1 -0
- package/build/api/parse-authorize-result.js +27 -0
- package/build/api/parse-authorize-result.js.map +1 -0
- package/build/api/require-music-user-token.d.ts +2 -0
- package/build/api/require-music-user-token.d.ts.map +1 -0
- package/build/api/require-music-user-token.js +14 -0
- package/build/api/require-music-user-token.js.map +1 -0
- package/build/api/sync-developer-token.d.ts +4 -0
- package/build/api/sync-developer-token.d.ts.map +1 -0
- package/build/api/sync-developer-token.js +27 -0
- package/build/api/sync-developer-token.js.map +1 -0
- package/build/bridge/bridge-methods.d.ts +17 -0
- package/build/bridge/bridge-methods.d.ts.map +1 -0
- package/build/bridge/bridge-methods.js +71 -0
- package/build/bridge/bridge-methods.js.map +1 -0
- package/build/bridge/bridge-responses.d.ts +64 -0
- package/build/bridge/bridge-responses.d.ts.map +1 -0
- package/build/bridge/bridge-responses.js +67 -0
- package/build/bridge/bridge-responses.js.map +1 -0
- package/build/bridge/handlers/auth-bridge.d.ts +11 -0
- package/build/bridge/handlers/auth-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/auth-bridge.js +49 -0
- package/build/bridge/handlers/auth-bridge.js.map +1 -0
- package/build/bridge/handlers/catalog-bridge.d.ts +34 -0
- package/build/bridge/handlers/catalog-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/catalog-bridge.js +58 -0
- package/build/bridge/handlers/catalog-bridge.js.map +1 -0
- package/build/bridge/handlers/history-bridge.d.ts +19 -0
- package/build/bridge/handlers/history-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/history-bridge.js +31 -0
- package/build/bridge/handlers/history-bridge.js.map +1 -0
- package/build/bridge/handlers/index.d.ts +124 -0
- package/build/bridge/handlers/index.d.ts.map +1 -0
- package/build/bridge/handlers/index.js +21 -0
- package/build/bridge/handlers/index.js.map +1 -0
- package/build/bridge/handlers/library-bridge.d.ts +23 -0
- package/build/bridge/handlers/library-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/library-bridge.js +41 -0
- package/build/bridge/handlers/library-bridge.js.map +1 -0
- package/build/bridge/handlers/library-mutations-bridge.d.ts +16 -0
- package/build/bridge/handlers/library-mutations-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/library-mutations-bridge.js +20 -0
- package/build/bridge/handlers/library-mutations-bridge.js.map +1 -0
- package/build/bridge/handlers/player-bridge.d.ts +18 -0
- package/build/bridge/handlers/player-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/player-bridge.js +42 -0
- package/build/bridge/handlers/player-bridge.js.map +1 -0
- package/build/bridge/handlers/ratings-bridge.d.ts +15 -0
- package/build/bridge/handlers/ratings-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/ratings-bridge.js +16 -0
- package/build/bridge/handlers/ratings-bridge.js.map +1 -0
- package/build/bridge/handlers/recommendations-bridge.d.ts +10 -0
- package/build/bridge/handlers/recommendations-bridge.d.ts.map +1 -0
- package/build/bridge/handlers/recommendations-bridge.js +14 -0
- package/build/bridge/handlers/recommendations-bridge.js.map +1 -0
- package/build/constants/apple-music-error-codes.d.ts +22 -0
- package/build/constants/apple-music-error-codes.d.ts.map +1 -0
- package/build/constants/apple-music-error-codes.js +21 -0
- package/build/constants/apple-music-error-codes.js.map +1 -0
- package/build/hooks/use-current-song.d.ts +10 -0
- package/build/hooks/use-current-song.d.ts.map +1 -0
- package/build/hooks/use-current-song.js +35 -0
- package/build/hooks/use-current-song.js.map +1 -0
- package/build/hooks/use-is-playing.d.ts +6 -0
- package/build/hooks/use-is-playing.d.ts.map +1 -0
- package/build/hooks/use-is-playing.js +21 -0
- package/build/hooks/use-is-playing.js.map +1 -0
- package/build/hooks/use-playback-state.d.ts +12 -0
- package/build/hooks/use-playback-state.d.ts.map +1 -0
- package/build/hooks/use-playback-state.js +41 -0
- package/build/hooks/use-playback-state.js.map +1 -0
- package/build/index.d.ts +52 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +44 -0
- package/build/index.js.map +1 -0
- package/build/mappers/apple-music-json-mapper.d.ts +94 -0
- package/build/mappers/apple-music-json-mapper.d.ts.map +1 -0
- package/build/mappers/apple-music-json-mapper.js +212 -0
- package/build/mappers/apple-music-json-mapper.js.map +1 -0
- package/build/modules/auth.d.ts +32 -0
- package/build/modules/auth.d.ts.map +1 -0
- package/build/modules/auth.js +60 -0
- package/build/modules/auth.js.map +1 -0
- package/build/modules/catalog.d.ts +46 -0
- package/build/modules/catalog.d.ts.map +1 -0
- package/build/modules/catalog.js +47 -0
- package/build/modules/catalog.js.map +1 -0
- package/build/modules/history.d.ts +17 -0
- package/build/modules/history.d.ts.map +1 -0
- package/build/modules/history.js +28 -0
- package/build/modules/history.js.map +1 -0
- package/build/modules/library-mutations.d.ts +9 -0
- package/build/modules/library-mutations.d.ts.map +1 -0
- package/build/modules/library-mutations.js +41 -0
- package/build/modules/library-mutations.js.map +1 -0
- package/build/modules/library.d.ts +21 -0
- package/build/modules/library.d.ts.map +1 -0
- package/build/modules/library.js +38 -0
- package/build/modules/library.js.map +1 -0
- package/build/modules/player.d.ts +53 -0
- package/build/modules/player.d.ts.map +1 -0
- package/build/modules/player.js +68 -0
- package/build/modules/player.js.map +1 -0
- package/build/modules/ratings.d.ts +10 -0
- package/build/modules/ratings.d.ts.map +1 -0
- package/build/modules/ratings.js +37 -0
- package/build/modules/ratings.js.map +1 -0
- package/build/modules/recommendations.d.ts +7 -0
- package/build/modules/recommendations.d.ts.map +1 -0
- package/build/modules/recommendations.js +15 -0
- package/build/modules/recommendations.js.map +1 -0
- package/build/native-module.d.ts +5 -0
- package/build/native-module.d.ts.map +1 -0
- package/build/native-module.js +5 -0
- package/build/native-module.js.map +1 -0
- package/build/native-module.web.d.ts +11 -0
- package/build/native-module.web.d.ts.map +1 -0
- package/build/native-module.web.js +11 -0
- package/build/native-module.web.js.map +1 -0
- package/build/rest/apple-music-rest-stack.d.ts +21 -0
- package/build/rest/apple-music-rest-stack.d.ts.map +1 -0
- package/build/rest/apple-music-rest-stack.js +21 -0
- package/build/rest/apple-music-rest-stack.js.map +1 -0
- package/build/rest/apple-music-rest-transport.d.ts +8 -0
- package/build/rest/apple-music-rest-transport.d.ts.map +1 -0
- package/build/rest/apple-music-rest-transport.js +2 -0
- package/build/rest/apple-music-rest-transport.js.map +1 -0
- package/build/rest/catalog-rest-client.d.ts +38 -0
- package/build/rest/catalog-rest-client.d.ts.map +1 -0
- package/build/rest/catalog-rest-client.js +189 -0
- package/build/rest/catalog-rest-client.js.map +1 -0
- package/build/rest/history-rest-client.d.ts +37 -0
- package/build/rest/history-rest-client.d.ts.map +1 -0
- package/build/rest/history-rest-client.js +30 -0
- package/build/rest/history-rest-client.js.map +1 -0
- package/build/rest/library-ids.d.ts +2 -0
- package/build/rest/library-ids.d.ts.map +1 -0
- package/build/rest/library-ids.js +2 -0
- package/build/rest/library-ids.js.map +1 -0
- package/build/rest/library-mutations-rest-client.d.ts +22 -0
- package/build/rest/library-mutations-rest-client.d.ts.map +1 -0
- package/build/rest/library-mutations-rest-client.js +37 -0
- package/build/rest/library-mutations-rest-client.js.map +1 -0
- package/build/rest/library-rest-client.d.ts +59 -0
- package/build/rest/library-rest-client.d.ts.map +1 -0
- package/build/rest/library-rest-client.js +141 -0
- package/build/rest/library-rest-client.js.map +1 -0
- package/build/rest/ratings-rest-client.d.ts +18 -0
- package/build/rest/ratings-rest-client.d.ts.map +1 -0
- package/build/rest/ratings-rest-client.js +37 -0
- package/build/rest/ratings-rest-client.js.map +1 -0
- package/build/rest/recommendations-rest-client.d.ts +32 -0
- package/build/rest/recommendations-rest-client.d.ts.map +1 -0
- package/build/rest/recommendations-rest-client.js +26 -0
- package/build/rest/recommendations-rest-client.js.map +1 -0
- package/build/rest/resource-ids-query.d.ts +2 -0
- package/build/rest/resource-ids-query.d.ts.map +1 -0
- package/build/rest/resource-ids-query.js +10 -0
- package/build/rest/resource-ids-query.js.map +1 -0
- package/build/rest/rest-json.d.ts +11 -0
- package/build/rest/rest-json.d.ts.map +1 -0
- package/build/rest/rest-json.js +29 -0
- package/build/rest/rest-json.js.map +1 -0
- package/build/rest/storefront-rest-client.d.ts +14 -0
- package/build/rest/storefront-rest-client.d.ts.map +1 -0
- package/build/rest/storefront-rest-client.js +36 -0
- package/build/rest/storefront-rest-client.js.map +1 -0
- package/build/types/album.d.ts +8 -0
- package/build/types/album.d.ts.map +1 -0
- package/build/types/album.js +2 -0
- package/build/types/album.js.map +1 -0
- package/build/types/albums-response.d.ts +5 -0
- package/build/types/albums-response.d.ts.map +1 -0
- package/build/types/albums-response.js +2 -0
- package/build/types/albums-response.js.map +1 -0
- package/build/types/android-authorize-options.d.ts +18 -0
- package/build/types/android-authorize-options.d.ts.map +1 -0
- package/build/types/android-authorize-options.js +2 -0
- package/build/types/android-authorize-options.js.map +1 -0
- package/build/types/artist.d.ts +9 -0
- package/build/types/artist.d.ts.map +1 -0
- package/build/types/artist.js +2 -0
- package/build/types/artist.js.map +1 -0
- package/build/types/auth-status.d.ts +19 -0
- package/build/types/auth-status.d.ts.map +1 -0
- package/build/types/auth-status.js +18 -0
- package/build/types/auth-status.js.map +1 -0
- package/build/types/authorize-result.d.ts +8 -0
- package/build/types/authorize-result.d.ts.map +1 -0
- package/build/types/authorize-result.js +2 -0
- package/build/types/authorize-result.js.map +1 -0
- package/build/types/catalog-album-tracks.d.ts +5 -0
- package/build/types/catalog-album-tracks.d.ts.map +1 -0
- package/build/types/catalog-album-tracks.js +2 -0
- package/build/types/catalog-album-tracks.js.map +1 -0
- package/build/types/catalog-charts.d.ts +25 -0
- package/build/types/catalog-charts.d.ts.map +1 -0
- package/build/types/catalog-charts.js +7 -0
- package/build/types/catalog-charts.js.map +1 -0
- package/build/types/catalog-resource-type.d.ts +11 -0
- package/build/types/catalog-resource-type.d.ts.map +1 -0
- package/build/types/catalog-resource-type.js +10 -0
- package/build/types/catalog-resource-type.js.map +1 -0
- package/build/types/catalog-search.d.ts +24 -0
- package/build/types/catalog-search.d.ts.map +1 -0
- package/build/types/catalog-search.js +9 -0
- package/build/types/catalog-search.js.map +1 -0
- package/build/types/check-subscription.d.ts +31 -0
- package/build/types/check-subscription.d.ts.map +1 -0
- package/build/types/check-subscription.js +5 -0
- package/build/types/check-subscription.js.map +1 -0
- package/build/types/library-music-videos.d.ts +5 -0
- package/build/types/library-music-videos.d.ts.map +1 -0
- package/build/types/library-music-videos.js +2 -0
- package/build/types/library-music-videos.js.map +1 -0
- package/build/types/library-mutations.d.ts +21 -0
- package/build/types/library-mutations.d.ts.map +1 -0
- package/build/types/library-mutations.js +8 -0
- package/build/types/library-mutations.js.map +1 -0
- package/build/types/library-search.d.ts +22 -0
- package/build/types/library-search.d.ts.map +1 -0
- package/build/types/library-search.js +9 -0
- package/build/types/library-search.js.map +1 -0
- package/build/types/music-item.d.ts +8 -0
- package/build/types/music-item.d.ts.map +1 -0
- package/build/types/music-item.js +7 -0
- package/build/types/music-item.js.map +1 -0
- package/build/types/music-video.d.ts +8 -0
- package/build/types/music-video.d.ts.map +1 -0
- package/build/types/music-video.js +2 -0
- package/build/types/music-video.js.map +1 -0
- package/build/types/pagination.d.ts +11 -0
- package/build/types/pagination.d.ts.map +1 -0
- package/build/types/pagination.js +2 -0
- package/build/types/pagination.js.map +1 -0
- package/build/types/playback-state.d.ts +9 -0
- package/build/types/playback-state.d.ts.map +1 -0
- package/build/types/playback-state.js +2 -0
- package/build/types/playback-state.js.map +1 -0
- package/build/types/playback-status.d.ts +10 -0
- package/build/types/playback-status.d.ts.map +1 -0
- package/build/types/playback-status.js +9 -0
- package/build/types/playback-status.js.map +1 -0
- package/build/types/playlist.d.ts +15 -0
- package/build/types/playlist.d.ts.map +1 -0
- package/build/types/playlist.js +2 -0
- package/build/types/playlist.js.map +1 -0
- package/build/types/rating.d.ts +34 -0
- package/build/types/rating.d.ts.map +1 -0
- package/build/types/rating.js +26 -0
- package/build/types/rating.js.map +1 -0
- package/build/types/recent-resource.d.ts +11 -0
- package/build/types/recent-resource.d.ts.map +1 -0
- package/build/types/recent-resource.js +2 -0
- package/build/types/recent-resource.js.map +1 -0
- package/build/types/recommendation.d.ts +37 -0
- package/build/types/recommendation.d.ts.map +1 -0
- package/build/types/recommendation.js +2 -0
- package/build/types/recommendation.js.map +1 -0
- package/build/types/song.d.ts +8 -0
- package/build/types/song.d.ts.map +1 -0
- package/build/types/song.js +2 -0
- package/build/types/song.js.map +1 -0
- package/build/types/station.d.ts +9 -0
- package/build/types/station.d.ts.map +1 -0
- package/build/types/station.js +2 -0
- package/build/types/station.js.map +1 -0
- package/build/types/storefront.d.ts +4 -0
- package/build/types/storefront.d.ts.map +1 -0
- package/build/types/storefront.js +2 -0
- package/build/types/storefront.js.map +1 -0
- package/build/types/tracks-from-library.d.ts +11 -0
- package/build/types/tracks-from-library.d.ts.map +1 -0
- package/build/types/tracks-from-library.js +2 -0
- package/build/types/tracks-from-library.js.map +1 -0
- package/build/utils/apple-music-error.d.ts +10 -0
- package/build/utils/apple-music-error.d.ts.map +1 -0
- package/build/utils/apple-music-error.js +13 -0
- package/build/utils/apple-music-error.js.map +1 -0
- package/build/utils/get-error-message.d.ts +2 -0
- package/build/utils/get-error-message.d.ts.map +1 -0
- package/build/utils/get-error-message.js +21 -0
- package/build/utils/get-error-message.js.map +1 -0
- package/build/utils/is-library-item.d.ts +2 -0
- package/build/utils/is-library-item.d.ts.map +1 -0
- package/build/utils/is-library-item.js +4 -0
- package/build/utils/is-library-item.js.map +1 -0
- package/build/utils/normalize-resource-ids.d.ts +4 -0
- package/build/utils/normalize-resource-ids.d.ts.map +1 -0
- package/build/utils/normalize-resource-ids.js +12 -0
- package/build/utils/normalize-resource-ids.js.map +1 -0
- package/build/web/MusicKitLoader.d.ts +11 -0
- package/build/web/MusicKitLoader.d.ts.map +1 -0
- package/build/web/MusicKitLoader.js +135 -0
- package/build/web/MusicKitLoader.js.map +1 -0
- package/build/web/WebAppleMusicApiClient.d.ts +151 -0
- package/build/web/WebAppleMusicApiClient.d.ts.map +1 -0
- package/build/web/WebAppleMusicApiClient.js +139 -0
- package/build/web/WebAppleMusicApiClient.js.map +1 -0
- package/build/web/WebAppleMusicRestTransport.d.ts +9 -0
- package/build/web/WebAppleMusicRestTransport.d.ts.map +1 -0
- package/build/web/WebAppleMusicRestTransport.js +31 -0
- package/build/web/WebAppleMusicRestTransport.js.map +1 -0
- package/build/web/WebPlaybackController.d.ts +12 -0
- package/build/web/WebPlaybackController.d.ts.map +1 -0
- package/build/web/WebPlaybackController.js +90 -0
- package/build/web/WebPlaybackController.js.map +1 -0
- package/build/web/WebPlaybackObserver.d.ts +22 -0
- package/build/web/WebPlaybackObserver.d.ts.map +1 -0
- package/build/web/WebPlaybackObserver.js +106 -0
- package/build/web/WebPlaybackObserver.js.map +1 -0
- package/build/web/WebQueueService.d.ts +10 -0
- package/build/web/WebQueueService.d.ts.map +1 -0
- package/build/web/WebQueueService.js +53 -0
- package/build/web/WebQueueService.js.map +1 -0
- package/build/web/WebSubscriptionService.d.ts +7 -0
- package/build/web/WebSubscriptionService.d.ts.map +1 -0
- package/build/web/WebSubscriptionService.js +24 -0
- package/build/web/WebSubscriptionService.js.map +1 -0
- package/build/web/apple-music-errors.d.ts +11 -0
- package/build/web/apple-music-errors.d.ts.map +1 -0
- package/build/web/apple-music-errors.js +31 -0
- package/build/web/apple-music-errors.js.map +1 -0
- package/build/web/extract-music-user-token.d.ts +4 -0
- package/build/web/extract-music-user-token.d.ts.map +1 -0
- package/build/web/extract-music-user-token.js +15 -0
- package/build/web/extract-music-user-token.js.map +1 -0
- package/build/web/map-auth-status.d.ts +17 -0
- package/build/web/map-auth-status.d.ts.map +1 -0
- package/build/web/map-auth-status.js +85 -0
- package/build/web/map-auth-status.js.map +1 -0
- package/build/web/music-kit-api.d.ts +18 -0
- package/build/web/music-kit-api.d.ts.map +1 -0
- package/build/web/music-kit-api.js +120 -0
- package/build/web/music-kit-api.js.map +1 -0
- package/build/web/musickit-types.d.ts +70 -0
- package/build/web/musickit-types.d.ts.map +1 -0
- package/build/web/musickit-types.js +3 -0
- package/build/web/musickit-types.js.map +1 -0
- package/build/web/pagination.d.ts +2 -0
- package/build/web/pagination.d.ts.map +1 -0
- package/build/web/pagination.js +2 -0
- package/build/web/pagination.js.map +1 -0
- package/expo-module.config.json +19 -0
- package/ios/AppleMusicBridgeError.swift +60 -0
- package/ios/AppleMusicErrorCodes.swift +11 -0
- package/ios/AppleMusicRestClient.swift +213 -0
- package/ios/AuthenticatedSession.swift +64 -0
- package/ios/BridgePagination.swift +17 -0
- package/ios/BridgeResponses.swift +82 -0
- package/ios/CatalogSearchStore.swift +13 -0
- package/ios/CatalogSearchStoreFactory.swift +31 -0
- package/ios/CatalogService.swift +307 -0
- package/ios/ExpoAppleMusic.podspec +29 -0
- package/ios/ExpoAppleMusicModule.swift +505 -0
- package/ios/HistoryService.swift +53 -0
- package/ios/LibraryMutationsService.swift +63 -0
- package/ios/LibraryService.swift +313 -0
- package/ios/MusicItemMapper.swift +171 -0
- package/ios/MusicKitAuthStorage.swift +38 -0
- package/ios/MusicKitCatalogSearchStore.swift +62 -0
- package/ios/PlaybackController.swift +201 -0
- package/ios/PlaybackObserver.swift +225 -0
- package/ios/QueueService.swift +166 -0
- package/ios/RatingsService.swift +66 -0
- package/ios/RecommendationsService.swift +34 -0
- package/ios/RestCatalogSearchStore.swift +62 -0
- package/ios/RestJsonMapper.swift +268 -0
- package/ios/StorefrontService.swift +55 -0
- package/ios/SubscriptionService.swift +119 -0
- package/ios/bridge/ExpoBridgeCatalog.swift +98 -0
- package/ios/bridge/ExpoBridgeHistory.swift +71 -0
- package/ios/bridge/ExpoBridgeLibrary.swift +93 -0
- package/ios/bridge/ExpoBridgeRecommendations.swift +28 -0
- package/package.json +89 -0
- package/plugin/build/index.d.ts +5 -0
- package/plugin/build/index.js +10 -0
- package/plugin/build/with-expo-apple-music.d.ts +10 -0
- package/plugin/build/with-expo-apple-music.js +50 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PaginationOptions } from '../types/pagination';
|
|
2
|
+
export declare const DEFAULT_PAGINATION_LIMIT = 25;
|
|
3
|
+
export declare const DEFAULT_PAGINATION_OFFSET = 0;
|
|
4
|
+
export interface NormalizedPagination {
|
|
5
|
+
limit: number;
|
|
6
|
+
offset: number;
|
|
7
|
+
}
|
|
8
|
+
/** Applies v1 defaults (limit 25, offset 0) and coerces to non-negative integers. */
|
|
9
|
+
export declare function normalizePaginationOptions(options?: PaginationOptions): NormalizedPagination;
|
|
10
|
+
/** Payload for native bridge methods that accept `limit` / `offset` in an options map. */
|
|
11
|
+
export declare function paginationBridgePayload(options?: PaginationOptions): PaginationOptions;
|
|
12
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/api/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qFAAqF;AACrF,wBAAgB,0BAA0B,CACxC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,oBAAoB,CAItB;AAED,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAEtF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const DEFAULT_PAGINATION_LIMIT = 25;
|
|
2
|
+
export const DEFAULT_PAGINATION_OFFSET = 0;
|
|
3
|
+
/** Applies v1 defaults (limit 25, offset 0) and coerces to non-negative integers. */
|
|
4
|
+
export function normalizePaginationOptions(options) {
|
|
5
|
+
const limit = Math.max(1, options?.limit ?? DEFAULT_PAGINATION_LIMIT);
|
|
6
|
+
const offset = Math.max(0, options?.offset ?? DEFAULT_PAGINATION_OFFSET);
|
|
7
|
+
return { limit, offset };
|
|
8
|
+
}
|
|
9
|
+
/** Payload for native bridge methods that accept `limit` / `offset` in an options map. */
|
|
10
|
+
export function paginationBridgePayload(options) {
|
|
11
|
+
return normalizePaginationOptions(options);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/api/pagination.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAO3C,qFAAqF;AACrF,MAAM,UAAU,0BAA0B,CACxC,OAA2B;IAE3B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,IAAI,wBAAwB,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,IAAI,yBAAyB,CAAC,CAAC;IACzE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,uBAAuB,CAAC,OAA2B;IACjE,OAAO,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { PaginationOptions } from '../types/pagination';\n\nexport const DEFAULT_PAGINATION_LIMIT = 25;\nexport const DEFAULT_PAGINATION_OFFSET = 0;\n\nexport interface NormalizedPagination {\n limit: number;\n offset: number;\n}\n\n/** Applies v1 defaults (limit 25, offset 0) and coerces to non-negative integers. */\nexport function normalizePaginationOptions(\n options?: PaginationOptions,\n): NormalizedPagination {\n const limit = Math.max(1, options?.limit ?? DEFAULT_PAGINATION_LIMIT);\n const offset = Math.max(0, options?.offset ?? DEFAULT_PAGINATION_OFFSET);\n return { limit, offset };\n}\n\n/** Payload for native bridge methods that accept `limit` / `offset` in an options map. */\nexport function paginationBridgePayload(options?: PaginationOptions): PaginationOptions {\n return normalizePaginationOptions(options);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-authorize-result.d.ts","sourceRoot":"","sources":["../../src/api/parse-authorize-result.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAcjE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAclE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AuthStatus } from '../types/auth-status';
|
|
2
|
+
const AUTH_STATUS_VALUES = new Set(Object.values(AuthStatus));
|
|
3
|
+
function normalizeStatus(value) {
|
|
4
|
+
if (typeof value === 'string') {
|
|
5
|
+
const trimmed = value.trim();
|
|
6
|
+
if (AUTH_STATUS_VALUES.has(trimmed)) {
|
|
7
|
+
return trimmed;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return AuthStatus.UNKNOWN;
|
|
11
|
+
}
|
|
12
|
+
export function parseAuthorizeResult(raw) {
|
|
13
|
+
if (raw == null) {
|
|
14
|
+
return { status: AuthStatus.UNKNOWN };
|
|
15
|
+
}
|
|
16
|
+
if (typeof raw === 'object' && 'status' in raw) {
|
|
17
|
+
const record = raw;
|
|
18
|
+
const musicUserToken = record.musicUserToken?.trim();
|
|
19
|
+
const status = normalizeStatus(record.status);
|
|
20
|
+
return {
|
|
21
|
+
status,
|
|
22
|
+
...(musicUserToken ? { musicUserToken } : {}),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return { status: normalizeStatus(raw) };
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=parse-authorize-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-authorize-result.js","sourceRoot":"","sources":["../../src/api/parse-authorize-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AAEtE,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,OAAO,OAAqB,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC/C,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,QAAQ,IAAI,GAAG,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,GAA2D,CAAC;QAC3E,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC;QACrD,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO;YACL,MAAM;YACN,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1C,CAAC","sourcesContent":["import { AuthStatus } from '../types/auth-status';\nimport type { AuthorizeResult } from '../types/authorize-result';\n\nconst AUTH_STATUS_VALUES = new Set<string>(Object.values(AuthStatus));\n\nfunction normalizeStatus(value: unknown): AuthStatus {\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (AUTH_STATUS_VALUES.has(trimmed)) {\n return trimmed as AuthStatus;\n }\n }\n return AuthStatus.UNKNOWN;\n}\n\nexport function parseAuthorizeResult(raw: unknown): AuthorizeResult {\n if (raw == null) {\n return { status: AuthStatus.UNKNOWN };\n }\n if (typeof raw === 'object' && 'status' in raw) {\n const record = raw as { status?: unknown; musicUserToken?: string | null };\n const musicUserToken = record.musicUserToken?.trim();\n const status = normalizeStatus(record.status);\n return {\n status,\n ...(musicUserToken ? { musicUserToken } : {}),\n };\n }\n return { status: normalizeStatus(raw) };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-music-user-token.d.ts","sourceRoot":"","sources":["../../src/api/require-music-user-token.ts"],"names":[],"mappings":"AAGA,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,SAAS,EAAE,MAAM,GAChB,MAAM,CAUR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AppleMusicErrorCode } from '../constants/apple-music-error-codes';
|
|
2
|
+
import { asThrownAppleMusicError } from '../utils/apple-music-error';
|
|
3
|
+
export function requireMusicUserToken(musicUserToken, operation) {
|
|
4
|
+
const trimmed = musicUserToken?.trim();
|
|
5
|
+
if (!trimmed) {
|
|
6
|
+
throw asThrownAppleMusicError({
|
|
7
|
+
code: AppleMusicErrorCode.missingMusicUserToken,
|
|
8
|
+
message: `Apple Music music user token is required for ${operation}. Pass the token from Auth.authorize() (store it in your app).`,
|
|
9
|
+
operation,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return trimmed;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=require-music-user-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-music-user-token.js","sourceRoot":"","sources":["../../src/api/require-music-user-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,UAAU,qBAAqB,CACnC,cAAyC,EACzC,SAAiB;IAEjB,MAAM,OAAO,GAAG,cAAc,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,uBAAuB,CAAC;YAC5B,IAAI,EAAE,mBAAmB,CAAC,qBAAqB;YAC/C,OAAO,EAAE,gDAAgD,SAAS,gEAAgE;YAClI,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { AppleMusicErrorCode } from '../constants/apple-music-error-codes';\nimport { asThrownAppleMusicError } from '../utils/apple-music-error';\n\nexport function requireMusicUserToken(\n musicUserToken: string | null | undefined,\n operation: string,\n): string {\n const trimmed = musicUserToken?.trim();\n if (!trimmed) {\n throw asThrownAppleMusicError({\n code: AppleMusicErrorCode.missingMusicUserToken,\n message: `Apple Music music user token is required for ${operation}. Pass the token from Auth.authorize() (store it in your app).`,\n operation,\n });\n }\n return trimmed;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function requireDeveloperTokenString(developerToken: string | undefined, operation: string): string;
|
|
2
|
+
/** Pushes the developer JWT to native storage (iOS/Android) or MusicKit JS (web). Does not run user auth. */
|
|
3
|
+
export declare function syncDeveloperTokenToPlatform(developerToken: string): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=sync-developer-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-developer-token.d.ts","sourceRoot":"","sources":["../../src/api/sync-developer-token.ts"],"names":[],"mappings":"AAMA,wBAAgB,2BAA2B,CACzC,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,SAAS,EAAE,MAAM,GAChB,MAAM,CASR;AAED,6GAA6G;AAC7G,wBAAsB,4BAA4B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUxF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { AppleMusicErrorCode } from '../constants/apple-music-error-codes';
|
|
3
|
+
import { MusicModule } from '../native-module';
|
|
4
|
+
import { configureMusicKit } from '../web/MusicKitLoader';
|
|
5
|
+
export function requireDeveloperTokenString(developerToken, operation) {
|
|
6
|
+
const trimmed = developerToken?.trim();
|
|
7
|
+
if (!trimmed) {
|
|
8
|
+
throw {
|
|
9
|
+
code: AppleMusicErrorCode.missingDeveloperToken,
|
|
10
|
+
message: `Apple Music developer JWT is required for ${operation}.`,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return trimmed;
|
|
14
|
+
}
|
|
15
|
+
/** Pushes the developer JWT to native storage (iOS/Android) or MusicKit JS (web). Does not run user auth. */
|
|
16
|
+
export async function syncDeveloperTokenToPlatform(developerToken) {
|
|
17
|
+
const trimmed = developerToken.trim();
|
|
18
|
+
if (!trimmed) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (Platform.OS === 'web') {
|
|
22
|
+
await configureMusicKit(trimmed);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
await MusicModule.setDeveloperToken(trimmed);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=sync-developer-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-developer-token.js","sourceRoot":"","sources":["../../src/api/sync-developer-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,UAAU,2BAA2B,CACzC,cAAkC,EAClC,SAAiB;IAEjB,MAAM,OAAO,GAAG,cAAc,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM;YACJ,IAAI,EAAE,mBAAmB,CAAC,qBAAqB;YAC/C,OAAO,EAAE,6CAA6C,SAAS,GAAG;SACnE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,6GAA6G;AAC7G,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,cAAsB;IACvE,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;IACtC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;IACT,CAAC;IACD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACjC,OAAO;IACT,CAAC;IACD,MAAM,WAAW,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import { Platform } from 'react-native';\n\nimport { AppleMusicErrorCode } from '../constants/apple-music-error-codes';\nimport { MusicModule } from '../native-module';\nimport { configureMusicKit } from '../web/MusicKitLoader';\n\nexport function requireDeveloperTokenString(\n developerToken: string | undefined,\n operation: string,\n): string {\n const trimmed = developerToken?.trim();\n if (!trimmed) {\n throw {\n code: AppleMusicErrorCode.missingDeveloperToken,\n message: `Apple Music developer JWT is required for ${operation}.`,\n };\n }\n return trimmed;\n}\n\n/** Pushes the developer JWT to native storage (iOS/Android) or MusicKit JS (web). Does not run user auth. */\nexport async function syncDeveloperTokenToPlatform(developerToken: string): Promise<void> {\n const trimmed = developerToken.trim();\n if (!trimmed) {\n return;\n }\n if (Platform.OS === 'web') {\n await configureMusicKit(trimmed);\n return;\n }\n await MusicModule.setDeveloperToken(trimmed);\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Expo bridge method names grouped by domain.
|
|
3
|
+
* Native modules (iOS/Android/Web) should register exactly these names.
|
|
4
|
+
* Public JS API lives in `src/modules/*` (`Catalog.search` → `catalogSearch`, etc.).
|
|
5
|
+
*/
|
|
6
|
+
export type BridgeDomain = 'auth' | 'catalog' | 'library' | 'history' | 'player' | 'ratings' | 'libraryMutations' | 'recommendations';
|
|
7
|
+
export type BridgeMethodSpec = {
|
|
8
|
+
domain: BridgeDomain;
|
|
9
|
+
/** Expo `AsyncFunction` / `Function` name exposed to JS via `MusicModule`. */
|
|
10
|
+
nativeName: string;
|
|
11
|
+
/** Public TS module method (documentation / parity checks). */
|
|
12
|
+
publicName: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const BRIDGE_METHODS: readonly BridgeMethodSpec[];
|
|
15
|
+
export declare const BRIDGE_EVENTS: readonly ["onPlaybackStateChange", "onCurrentSongChange", "onPlaybackTimeUpdate", "onPlaybackError"];
|
|
16
|
+
export declare function bridgeMethodsForDomain(domain: BridgeDomain): BridgeMethodSpec[];
|
|
17
|
+
//# sourceMappingURL=bridge-methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-methods.d.ts","sourceRoot":"","sources":["../../src/bridge/bridge-methods.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,kBAAkB,GAClB,iBAAiB,CAAC;AAEtB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,YAAY,CAAC;IACrB,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,SAAS,gBAAgB,EA8D5C,CAAC;AAEX,eAAO,MAAM,aAAa,sGAKhB,CAAC;AAEX,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAE/E"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Expo bridge method names grouped by domain.
|
|
3
|
+
* Native modules (iOS/Android/Web) should register exactly these names.
|
|
4
|
+
* Public JS API lives in `src/modules/*` (`Catalog.search` → `catalogSearch`, etc.).
|
|
5
|
+
*/
|
|
6
|
+
export const BRIDGE_METHODS = [
|
|
7
|
+
{ domain: 'auth', nativeName: 'setDeveloperToken', publicName: 'Auth.setDeveloperToken' },
|
|
8
|
+
{ domain: 'auth', nativeName: 'authorization', publicName: 'Auth.authorize' },
|
|
9
|
+
{ domain: 'auth', nativeName: 'checkSubscription', publicName: 'Auth.checkSubscription' },
|
|
10
|
+
{ domain: 'auth', nativeName: 'getStorefront', publicName: 'Auth.getStorefront' },
|
|
11
|
+
{ domain: 'catalog', nativeName: 'catalogSearch', publicName: 'Catalog.search' },
|
|
12
|
+
{ domain: 'catalog', nativeName: 'getCatalogSong', publicName: 'Catalog.getSong' },
|
|
13
|
+
{ domain: 'catalog', nativeName: 'getCatalogAlbum', publicName: 'Catalog.getAlbum' },
|
|
14
|
+
{ domain: 'catalog', nativeName: 'getCatalogArtist', publicName: 'Catalog.getArtist' },
|
|
15
|
+
{ domain: 'catalog', nativeName: 'getCatalogPlaylist', publicName: 'Catalog.getPlaylist' },
|
|
16
|
+
{ domain: 'catalog', nativeName: 'getCatalogStation', publicName: 'Catalog.getStation' },
|
|
17
|
+
{ domain: 'catalog', nativeName: 'getCatalogMusicVideo', publicName: 'Catalog.getMusicVideo' },
|
|
18
|
+
{ domain: 'catalog', nativeName: 'getCatalogAlbumTracks', publicName: 'Catalog.getAlbumTracks' },
|
|
19
|
+
{ domain: 'catalog', nativeName: 'getCatalogArtistAlbums', publicName: 'Catalog.getArtistAlbums' },
|
|
20
|
+
{ domain: 'catalog', nativeName: 'getCatalogPlaylistTracks', publicName: 'Catalog.getPlaylistTracks' },
|
|
21
|
+
{ domain: 'catalog', nativeName: 'getCatalogCharts', publicName: 'Catalog.getCharts' },
|
|
22
|
+
{ domain: 'catalog', nativeName: 'getCatalogResources', publicName: 'Catalog.getByIds' },
|
|
23
|
+
{ domain: 'library', nativeName: 'getUserPlaylists', publicName: 'Library.getPlaylists' },
|
|
24
|
+
{ domain: 'library', nativeName: 'getLibrarySongs', publicName: 'Library.getSongs' },
|
|
25
|
+
{ domain: 'library', nativeName: 'getPlaylistSongs', publicName: 'Library.getPlaylistTracks' },
|
|
26
|
+
{ domain: 'library', nativeName: 'getLibraryArtists', publicName: 'Library.getArtists' },
|
|
27
|
+
{ domain: 'library', nativeName: 'getLibraryAlbums', publicName: 'Library.getAlbums' },
|
|
28
|
+
{ domain: 'library', nativeName: 'getLibraryMusicVideos', publicName: 'Library.getMusicVideos' },
|
|
29
|
+
{ domain: 'library', nativeName: 'librarySearch', publicName: 'Library.search' },
|
|
30
|
+
{ domain: 'history', nativeName: 'getRecentlyPlayedResources', publicName: 'History.getRecentlyPlayedResources' },
|
|
31
|
+
{ domain: 'history', nativeName: 'getRecentlyPlayedTracks', publicName: 'History.getRecentlyPlayedTracks' },
|
|
32
|
+
{ domain: 'history', nativeName: 'getHeavyRotation', publicName: 'History.getHeavyRotation' },
|
|
33
|
+
{ domain: 'history', nativeName: 'getRecentlyPlayedStations', publicName: 'History.getRecentlyPlayedStations' },
|
|
34
|
+
{ domain: 'history', nativeName: 'getRecentlyAdded', publicName: 'History.getRecentlyAdded' },
|
|
35
|
+
{ domain: 'player', nativeName: 'setPlaybackQueue', publicName: 'Player.setQueue' },
|
|
36
|
+
{ domain: 'player', nativeName: 'playLibrarySong', publicName: 'Player.playLibrarySong' },
|
|
37
|
+
{ domain: 'player', nativeName: 'playLibraryPlaylist', publicName: 'Player.playLibraryPlaylist' },
|
|
38
|
+
{ domain: 'player', nativeName: 'configurePlayer', publicName: 'Player.configurePlayer' },
|
|
39
|
+
{ domain: 'player', nativeName: 'getCurrentState', publicName: 'Player.getCurrentState' },
|
|
40
|
+
{ domain: 'player', nativeName: 'play', publicName: 'Player.play' },
|
|
41
|
+
{ domain: 'player', nativeName: 'pause', publicName: 'Player.pause' },
|
|
42
|
+
{ domain: 'player', nativeName: 'skipToNextEntry', publicName: 'Player.skipToNextEntry' },
|
|
43
|
+
{ domain: 'player', nativeName: 'skipToPreviousEntry', publicName: 'Player.skipToPreviousEntry' },
|
|
44
|
+
{ domain: 'player', nativeName: 'restartCurrentEntry', publicName: 'Player.restartCurrentEntry' },
|
|
45
|
+
{ domain: 'player', nativeName: 'seekToTime', publicName: 'Player.seekToTime' },
|
|
46
|
+
{ domain: 'player', nativeName: 'togglePlayerState', publicName: 'Player.togglePlayerState' },
|
|
47
|
+
{ domain: 'ratings', nativeName: 'getRating', publicName: 'Ratings.getRating' },
|
|
48
|
+
{ domain: 'ratings', nativeName: 'setRating', publicName: 'Ratings.setRating' },
|
|
49
|
+
{ domain: 'ratings', nativeName: 'clearRating', publicName: 'Ratings.clearRating' },
|
|
50
|
+
{ domain: 'ratings', nativeName: 'addToFavorites', publicName: 'Ratings.addToFavorites' },
|
|
51
|
+
{ domain: 'ratings', nativeName: 'removeFromFavorites', publicName: 'Ratings.removeFromFavorites' },
|
|
52
|
+
{ domain: 'libraryMutations', nativeName: 'addToLibrary', publicName: 'LibraryMutations.addToLibrary' },
|
|
53
|
+
{ domain: 'libraryMutations', nativeName: 'createLibraryPlaylist', publicName: 'LibraryMutations.createPlaylist' },
|
|
54
|
+
{
|
|
55
|
+
domain: 'libraryMutations',
|
|
56
|
+
nativeName: 'addTracksToLibraryPlaylist',
|
|
57
|
+
publicName: 'LibraryMutations.addTracksToPlaylist',
|
|
58
|
+
},
|
|
59
|
+
{ domain: 'recommendations', nativeName: 'getRecommendations', publicName: 'Recommendations.get' },
|
|
60
|
+
{ domain: 'recommendations', nativeName: 'getReplay', publicName: 'Recommendations.getReplay' },
|
|
61
|
+
];
|
|
62
|
+
export const BRIDGE_EVENTS = [
|
|
63
|
+
'onPlaybackStateChange',
|
|
64
|
+
'onCurrentSongChange',
|
|
65
|
+
'onPlaybackTimeUpdate',
|
|
66
|
+
'onPlaybackError',
|
|
67
|
+
];
|
|
68
|
+
export function bridgeMethodsForDomain(domain) {
|
|
69
|
+
return BRIDGE_METHODS.filter((m) => m.domain === domain);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=bridge-methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-methods.js","sourceRoot":"","sources":["../../src/bridge/bridge-methods.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoBH,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,wBAAwB,EAAE;IACzF,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE;IAC7E,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,wBAAwB,EAAE;IACzF,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,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AEnG,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,+BAA+B,EAAE;IACvG,EAAE,MAAM,EAAE,kBAAkB,EAAE,UAAU,EAAE,uBAAuB,EAAE,UAAU,EAAE,iCAAiC,EAAE;IAClH;QACE,MAAM,EAAE,kBAAkB;QAC1B,UAAU,EAAE,4BAA4B;QACxC,UAAU,EAAE,sCAAsC;KACnD;IAED,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,oBAAoB,EAAE,UAAU,EAAE,qBAAqB,EAAE;IAClG,EAAE,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,2BAA2B,EAAE;CACvF,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,uBAAuB;IACvB,qBAAqB;IACrB,sBAAsB;IACtB,iBAAiB;CACT,CAAC;AAEX,MAAM,UAAU,sBAAsB,CAAC,MAAoB;IACzD,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * Canonical Expo bridge method names grouped by domain.\n * Native modules (iOS/Android/Web) should register exactly these names.\n * Public JS API lives in `src/modules/*` (`Catalog.search` → `catalogSearch`, etc.).\n */\n\nexport type BridgeDomain =\n | 'auth'\n | 'catalog'\n | 'library'\n | 'history'\n | 'player'\n | 'ratings'\n | 'libraryMutations'\n | 'recommendations';\n\nexport type BridgeMethodSpec = {\n domain: BridgeDomain;\n /** Expo `AsyncFunction` / `Function` name exposed to JS via `MusicModule`. */\n nativeName: string;\n /** Public TS module method (documentation / parity checks). */\n publicName: string;\n};\n\nexport const BRIDGE_METHODS: readonly BridgeMethodSpec[] = [\n { domain: 'auth', nativeName: 'setDeveloperToken', publicName: 'Auth.setDeveloperToken' },\n { domain: 'auth', nativeName: 'authorization', publicName: 'Auth.authorize' },\n { domain: 'auth', nativeName: 'checkSubscription', publicName: 'Auth.checkSubscription' },\n { domain: 'auth', nativeName: 'getStorefront', publicName: 'Auth.getStorefront' },\n\n { domain: 'catalog', nativeName: 'catalogSearch', publicName: 'Catalog.search' },\n { domain: 'catalog', nativeName: 'getCatalogSong', publicName: 'Catalog.getSong' },\n { domain: 'catalog', nativeName: 'getCatalogAlbum', publicName: 'Catalog.getAlbum' },\n { domain: 'catalog', nativeName: 'getCatalogArtist', publicName: 'Catalog.getArtist' },\n { domain: 'catalog', nativeName: 'getCatalogPlaylist', publicName: 'Catalog.getPlaylist' },\n { domain: 'catalog', nativeName: 'getCatalogStation', publicName: 'Catalog.getStation' },\n { domain: 'catalog', nativeName: 'getCatalogMusicVideo', publicName: 'Catalog.getMusicVideo' },\n { domain: 'catalog', nativeName: 'getCatalogAlbumTracks', publicName: 'Catalog.getAlbumTracks' },\n { domain: 'catalog', nativeName: 'getCatalogArtistAlbums', publicName: 'Catalog.getArtistAlbums' },\n { domain: 'catalog', nativeName: 'getCatalogPlaylistTracks', publicName: 'Catalog.getPlaylistTracks' },\n { domain: 'catalog', nativeName: 'getCatalogCharts', publicName: 'Catalog.getCharts' },\n { domain: 'catalog', nativeName: 'getCatalogResources', publicName: 'Catalog.getByIds' },\n\n { domain: 'library', nativeName: 'getUserPlaylists', publicName: 'Library.getPlaylists' },\n { domain: 'library', nativeName: 'getLibrarySongs', publicName: 'Library.getSongs' },\n { domain: 'library', nativeName: 'getPlaylistSongs', publicName: 'Library.getPlaylistTracks' },\n { domain: 'library', nativeName: 'getLibraryArtists', publicName: 'Library.getArtists' },\n { domain: 'library', nativeName: 'getLibraryAlbums', publicName: 'Library.getAlbums' },\n { domain: 'library', nativeName: 'getLibraryMusicVideos', publicName: 'Library.getMusicVideos' },\n { domain: 'library', nativeName: 'librarySearch', publicName: 'Library.search' },\n\n { domain: 'history', nativeName: 'getRecentlyPlayedResources', publicName: 'History.getRecentlyPlayedResources' },\n { domain: 'history', nativeName: 'getRecentlyPlayedTracks', publicName: 'History.getRecentlyPlayedTracks' },\n { domain: 'history', nativeName: 'getHeavyRotation', publicName: 'History.getHeavyRotation' },\n { domain: 'history', nativeName: 'getRecentlyPlayedStations', publicName: 'History.getRecentlyPlayedStations' },\n { domain: 'history', nativeName: 'getRecentlyAdded', publicName: 'History.getRecentlyAdded' },\n\n { domain: 'player', nativeName: 'setPlaybackQueue', publicName: 'Player.setQueue' },\n { domain: 'player', nativeName: 'playLibrarySong', publicName: 'Player.playLibrarySong' },\n { domain: 'player', nativeName: 'playLibraryPlaylist', publicName: 'Player.playLibraryPlaylist' },\n { domain: 'player', nativeName: 'configurePlayer', publicName: 'Player.configurePlayer' },\n { domain: 'player', nativeName: 'getCurrentState', publicName: 'Player.getCurrentState' },\n { domain: 'player', nativeName: 'play', publicName: 'Player.play' },\n { domain: 'player', nativeName: 'pause', publicName: 'Player.pause' },\n { domain: 'player', nativeName: 'skipToNextEntry', publicName: 'Player.skipToNextEntry' },\n { domain: 'player', nativeName: 'skipToPreviousEntry', publicName: 'Player.skipToPreviousEntry' },\n { domain: 'player', nativeName: 'restartCurrentEntry', publicName: 'Player.restartCurrentEntry' },\n { domain: 'player', nativeName: 'seekToTime', publicName: 'Player.seekToTime' },\n { domain: 'player', nativeName: 'togglePlayerState', publicName: 'Player.togglePlayerState' },\n\n { domain: 'ratings', nativeName: 'getRating', publicName: 'Ratings.getRating' },\n { domain: 'ratings', nativeName: 'setRating', publicName: 'Ratings.setRating' },\n { domain: 'ratings', nativeName: 'clearRating', publicName: 'Ratings.clearRating' },\n { domain: 'ratings', nativeName: 'addToFavorites', publicName: 'Ratings.addToFavorites' },\n { domain: 'ratings', nativeName: 'removeFromFavorites', publicName: 'Ratings.removeFromFavorites' },\n\n { domain: 'libraryMutations', nativeName: 'addToLibrary', publicName: 'LibraryMutations.addToLibrary' },\n { domain: 'libraryMutations', nativeName: 'createLibraryPlaylist', publicName: 'LibraryMutations.createPlaylist' },\n {\n domain: 'libraryMutations',\n nativeName: 'addTracksToLibraryPlaylist',\n publicName: 'LibraryMutations.addTracksToPlaylist',\n },\n\n { domain: 'recommendations', nativeName: 'getRecommendations', publicName: 'Recommendations.get' },\n { domain: 'recommendations', nativeName: 'getReplay', publicName: 'Recommendations.getReplay' },\n] as const;\n\nexport const BRIDGE_EVENTS = [\n 'onPlaybackStateChange',\n 'onCurrentSongChange',\n 'onPlaybackTimeUpdate',\n 'onPlaybackError',\n] as const;\n\nexport function bridgeMethodsForDomain(domain: BridgeDomain): BridgeMethodSpec[] {\n return BRIDGE_METHODS.filter((m) => m.domain === domain);\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Standard bridge response envelopes (keys match iOS/Android native modules). */
|
|
2
|
+
export type CatalogSearchPayload = {
|
|
3
|
+
songs: unknown[];
|
|
4
|
+
albums: unknown[];
|
|
5
|
+
artists: unknown[];
|
|
6
|
+
playlists: unknown[];
|
|
7
|
+
stations: unknown[];
|
|
8
|
+
musicVideos: unknown[];
|
|
9
|
+
};
|
|
10
|
+
export type CatalogChartsPayload = {
|
|
11
|
+
songs: unknown[];
|
|
12
|
+
albums: unknown[];
|
|
13
|
+
playlists: unknown[];
|
|
14
|
+
musicVideos: unknown[];
|
|
15
|
+
};
|
|
16
|
+
export type LibrarySearchPayload = {
|
|
17
|
+
songs: unknown[];
|
|
18
|
+
albums: unknown[];
|
|
19
|
+
artists: unknown[];
|
|
20
|
+
playlists: unknown[];
|
|
21
|
+
musicVideos: unknown[];
|
|
22
|
+
};
|
|
23
|
+
export declare const BridgeResponses: {
|
|
24
|
+
readonly storefront: (id: string) => {
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
27
|
+
readonly catalogSearch: (result: CatalogSearchPayload) => CatalogSearchPayload;
|
|
28
|
+
readonly catalogCharts: (result: CatalogChartsPayload) => CatalogChartsPayload;
|
|
29
|
+
readonly librarySearch: (result: LibrarySearchPayload) => LibrarySearchPayload;
|
|
30
|
+
readonly musicVideos: (items: unknown[]) => {
|
|
31
|
+
musicVideos: unknown[];
|
|
32
|
+
};
|
|
33
|
+
readonly songs: (items: unknown[]) => {
|
|
34
|
+
songs: unknown[];
|
|
35
|
+
};
|
|
36
|
+
readonly albums: (items: unknown[]) => {
|
|
37
|
+
albums: unknown[];
|
|
38
|
+
};
|
|
39
|
+
readonly artists: (items: unknown[]) => {
|
|
40
|
+
artists: unknown[];
|
|
41
|
+
};
|
|
42
|
+
readonly playlists: (items: unknown[]) => {
|
|
43
|
+
playlists: unknown[];
|
|
44
|
+
};
|
|
45
|
+
readonly stations: (items: unknown[]) => {
|
|
46
|
+
stations: unknown[];
|
|
47
|
+
};
|
|
48
|
+
readonly recentlyPlayedResources: (items: unknown[]) => {
|
|
49
|
+
recentlyPlayedItems: unknown[];
|
|
50
|
+
};
|
|
51
|
+
readonly recentItems: (items: unknown[]) => {
|
|
52
|
+
items: unknown[];
|
|
53
|
+
};
|
|
54
|
+
readonly recommendations: (items: unknown[]) => {
|
|
55
|
+
recommendations: unknown[];
|
|
56
|
+
};
|
|
57
|
+
readonly replaySummaries: (items: unknown[]) => {
|
|
58
|
+
summaries: unknown[];
|
|
59
|
+
};
|
|
60
|
+
readonly configurePlayer: (mixWithOthers: boolean) => {
|
|
61
|
+
mixWithOthers: boolean;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=bridge-responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-responses.d.ts","sourceRoot":"","sources":["../../src/bridge/bridge-responses.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAElF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,WAAW,EAAE,OAAO,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CAI1C,OAAO,EAAE,KAAG;QAAE,SAAS,EAAE,OAAO,EAAE,CAAA;KAAE;8CAI5B,OAAO,KAAG;QAAE,aAAa,EAAE,OAAO,CAAA;KAAE;CAG3D,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** Standard bridge response envelopes (keys match iOS/Android native modules). */
|
|
2
|
+
export const BridgeResponses = {
|
|
3
|
+
storefront(id) {
|
|
4
|
+
return { id };
|
|
5
|
+
},
|
|
6
|
+
catalogSearch(result) {
|
|
7
|
+
return {
|
|
8
|
+
songs: result.songs,
|
|
9
|
+
albums: result.albums,
|
|
10
|
+
artists: result.artists,
|
|
11
|
+
playlists: result.playlists,
|
|
12
|
+
stations: result.stations,
|
|
13
|
+
musicVideos: result.musicVideos,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
catalogCharts(result) {
|
|
17
|
+
return {
|
|
18
|
+
songs: result.songs,
|
|
19
|
+
albums: result.albums,
|
|
20
|
+
playlists: result.playlists,
|
|
21
|
+
musicVideos: result.musicVideos,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
librarySearch(result) {
|
|
25
|
+
return {
|
|
26
|
+
songs: result.songs,
|
|
27
|
+
albums: result.albums,
|
|
28
|
+
artists: result.artists,
|
|
29
|
+
playlists: result.playlists,
|
|
30
|
+
musicVideos: result.musicVideos,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
musicVideos(items) {
|
|
34
|
+
return { musicVideos: items };
|
|
35
|
+
},
|
|
36
|
+
songs(items) {
|
|
37
|
+
return { songs: items };
|
|
38
|
+
},
|
|
39
|
+
albums(items) {
|
|
40
|
+
return { albums: items };
|
|
41
|
+
},
|
|
42
|
+
artists(items) {
|
|
43
|
+
return { artists: items };
|
|
44
|
+
},
|
|
45
|
+
playlists(items) {
|
|
46
|
+
return { playlists: items };
|
|
47
|
+
},
|
|
48
|
+
stations(items) {
|
|
49
|
+
return { stations: items };
|
|
50
|
+
},
|
|
51
|
+
recentlyPlayedResources(items) {
|
|
52
|
+
return { recentlyPlayedItems: items };
|
|
53
|
+
},
|
|
54
|
+
recentItems(items) {
|
|
55
|
+
return { items: items };
|
|
56
|
+
},
|
|
57
|
+
recommendations(items) {
|
|
58
|
+
return { recommendations: items };
|
|
59
|
+
},
|
|
60
|
+
replaySummaries(items) {
|
|
61
|
+
return { summaries: items };
|
|
62
|
+
},
|
|
63
|
+
configurePlayer(mixWithOthers) {
|
|
64
|
+
return { mixWithOthers };
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=bridge-responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-responses.js","sourceRoot":"","sources":["../../src/bridge/bridge-responses.ts"],"names":[],"mappings":"AAAA,kFAAkF;AA0BlF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,UAAU,CAAC,EAAU;QACnB,OAAO,EAAE,EAAE,EAAE,CAAC;IAChB,CAAC;IAED,aAAa,CAAC,MAA4B;QACxC,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAA4B;QACxC,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,MAA4B;QACxC,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,KAAgB;QAC1B,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,KAAgB;QACpB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,KAAgB;QACrB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,CAAC,KAAgB;QACtB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,SAAS,CAAC,KAAgB;QACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,KAAgB;QACvB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED,uBAAuB,CAAC,KAAgB;QACtC,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;IACxC,CAAC;IAED,WAAW,CAAC,KAAgB;QAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,eAAe,CAAC,KAAgB;QAC9B,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;IACpC,CAAC;IAED,eAAe,CAAC,KAAgB;QAC9B,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,eAAe,CAAC,aAAsB;QACpC,OAAO,EAAE,aAAa,EAAE,CAAC;IAC3B,CAAC;CACO,CAAC","sourcesContent":["/** Standard bridge response envelopes (keys match iOS/Android native modules). */\n\nexport type CatalogSearchPayload = {\n songs: unknown[];\n albums: unknown[];\n artists: unknown[];\n playlists: unknown[];\n stations: unknown[];\n musicVideos: unknown[];\n};\n\nexport type CatalogChartsPayload = {\n songs: unknown[];\n albums: unknown[];\n playlists: unknown[];\n musicVideos: unknown[];\n};\n\nexport type LibrarySearchPayload = {\n songs: unknown[];\n albums: unknown[];\n artists: unknown[];\n playlists: unknown[];\n musicVideos: unknown[];\n};\n\nexport const BridgeResponses = {\n storefront(id: string): { id: string } {\n return { id };\n },\n\n catalogSearch(result: CatalogSearchPayload): CatalogSearchPayload {\n return {\n songs: result.songs,\n albums: result.albums,\n artists: result.artists,\n playlists: result.playlists,\n stations: result.stations,\n musicVideos: result.musicVideos,\n };\n },\n\n catalogCharts(result: CatalogChartsPayload): CatalogChartsPayload {\n return {\n songs: result.songs,\n albums: result.albums,\n playlists: result.playlists,\n musicVideos: result.musicVideos,\n };\n },\n\n librarySearch(result: LibrarySearchPayload): LibrarySearchPayload {\n return {\n songs: result.songs,\n albums: result.albums,\n artists: result.artists,\n playlists: result.playlists,\n musicVideos: result.musicVideos,\n };\n },\n\n musicVideos(items: unknown[]): { musicVideos: unknown[] } {\n return { musicVideos: items };\n },\n\n songs(items: unknown[]): { songs: unknown[] } {\n return { songs: items };\n },\n\n albums(items: unknown[]): { albums: unknown[] } {\n return { albums: items };\n },\n\n artists(items: unknown[]): { artists: unknown[] } {\n return { artists: items };\n },\n\n playlists(items: unknown[]): { playlists: unknown[] } {\n return { playlists: items };\n },\n\n stations(items: unknown[]): { stations: unknown[] } {\n return { stations: items };\n },\n\n recentlyPlayedResources(items: unknown[]): { recentlyPlayedItems: unknown[] } {\n return { recentlyPlayedItems: items };\n },\n\n recentItems(items: unknown[]): { items: unknown[] } {\n return { items: items };\n },\n\n recommendations(items: unknown[]): { recommendations: unknown[] } {\n return { recommendations: items };\n },\n\n replaySummaries(items: unknown[]): { summaries: unknown[] } {\n return { summaries: items };\n },\n\n configurePlayer(mixWithOthers: boolean): { mixWithOthers: boolean } {\n return { mixWithOthers };\n },\n} as const;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WebAppleMusicApiClient } from '../../web/WebAppleMusicApiClient';
|
|
2
|
+
import type { WebSubscriptionService } from '../../web/WebSubscriptionService';
|
|
3
|
+
export declare function createAuthBridge(api: WebAppleMusicApiClient, subscription: WebSubscriptionService): {
|
|
4
|
+
setDeveloperToken(token: string): Promise<void>;
|
|
5
|
+
authorization(developerToken: string | null, _startScreenMessage: string | null, _hideStartScreen: boolean | null): Promise<Record<string, string | undefined>>;
|
|
6
|
+
checkSubscription: (musicUserToken: string) => Promise<Record<string, unknown>>;
|
|
7
|
+
getStorefront(musicUserToken: string): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=auth-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-bridge.d.ts","sourceRoot":"","sources":["../../../src/bridge/handlers/auth-bridge.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAU/E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,sBAAsB,EAAE,YAAY,EAAE,sBAAsB;6BAE/D,MAAM;kCAKnB,MAAM,GAAG,IAAI,uBACR,MAAM,GAAG,IAAI,oBAChB,OAAO,GAAG,IAAI,GAC/B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;wCA0BV,MAAM;kCAEN,MAAM;;;EAK7C"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { configureMusicKit, getMusicKitInstance } from '../../web/MusicKitLoader';
|
|
2
|
+
import { extractMusicUserToken } from '../../web/extract-music-user-token';
|
|
3
|
+
import { authStatusFromAuthorizeError, authStatusFromMusicKit } from '../../web/map-auth-status';
|
|
4
|
+
import * as errors from '../../web/apple-music-errors';
|
|
5
|
+
import { BridgeResponses } from '../bridge-responses';
|
|
6
|
+
function requireDeveloperToken(developerToken) {
|
|
7
|
+
if (!developerToken?.trim()) {
|
|
8
|
+
throw errors.missingDeveloperToken();
|
|
9
|
+
}
|
|
10
|
+
return developerToken.trim();
|
|
11
|
+
}
|
|
12
|
+
export function createAuthBridge(api, subscription) {
|
|
13
|
+
return {
|
|
14
|
+
async setDeveloperToken(token) {
|
|
15
|
+
await configureMusicKit(requireDeveloperToken(token));
|
|
16
|
+
},
|
|
17
|
+
async authorization(developerToken, _startScreenMessage, _hideStartScreen) {
|
|
18
|
+
const token = requireDeveloperToken(developerToken);
|
|
19
|
+
const music = await configureMusicKit(token);
|
|
20
|
+
if (music.isAuthorized) {
|
|
21
|
+
return {
|
|
22
|
+
status: 'authorized',
|
|
23
|
+
musicUserToken: extractMusicUserToken(music),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const result = await music.authorize();
|
|
28
|
+
const musicAfter = await getMusicKitInstance();
|
|
29
|
+
const status = authStatusFromMusicKit(musicAfter, result);
|
|
30
|
+
const resolvedStatus = status ?? 'unknown';
|
|
31
|
+
return {
|
|
32
|
+
status: resolvedStatus,
|
|
33
|
+
musicUserToken: resolvedStatus === 'authorized'
|
|
34
|
+
? extractMusicUserToken(musicAfter, result)
|
|
35
|
+
: undefined,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return { status: authStatusFromAuthorizeError(error) };
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
checkSubscription: (musicUserToken) => subscription.checkSubscription(musicUserToken),
|
|
43
|
+
async getStorefront(musicUserToken) {
|
|
44
|
+
const id = await api.getStorefront(musicUserToken);
|
|
45
|
+
return BridgeResponses.storefront(id);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=auth-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-bridge.js","sourceRoot":"","sources":["../../../src/bridge/handlers/auth-bridge.ts"],"names":[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GAAG,MAAM,IAAI,SAAS,CAAC;gBAC3C,OAAO;oBACL,MAAM,EAAE,cAAc;oBACtB,cAAc,EACZ,cAAc,KAAK,YAAY;wBAC7B,CAAC,CAAC,qBAAqB,CAAC,UAAU,EAAE,MAAM,CAAC;wBAC3C,CAAC,CAAC,SAAS;iBAChB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,EAAE,MAAM,EAAE,4BAA4B,CAAC,KAAK,CAAC,EAAE,CAAC;YACzD,CAAC;QACH,CAAC;QAED,iBAAiB,EAAE,CAAC,cAAsB,EAAE,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,cAAc,CAAC;QAE7F,KAAK,CAAC,aAAa,CAAC,cAAsB;YACxC,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;YACnD,OAAO,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { configureMusicKit, getMusicKitInstance } from '../../web/MusicKitLoader';\nimport { extractMusicUserToken } from '../../web/extract-music-user-token';\nimport { authStatusFromAuthorizeError, authStatusFromMusicKit } from '../../web/map-auth-status';\nimport * as errors from '../../web/apple-music-errors';\nimport type { WebAppleMusicApiClient } from '../../web/WebAppleMusicApiClient';\nimport type { WebSubscriptionService } from '../../web/WebSubscriptionService';\nimport { BridgeResponses } from '../bridge-responses';\n\nfunction requireDeveloperToken(developerToken: string | null | undefined): string {\n if (!developerToken?.trim()) {\n throw errors.missingDeveloperToken();\n }\n return developerToken.trim();\n}\n\nexport function createAuthBridge(api: WebAppleMusicApiClient, subscription: WebSubscriptionService) {\n return {\n async setDeveloperToken(token: string) {\n await configureMusicKit(requireDeveloperToken(token));\n },\n\n async authorization(\n developerToken: string | null,\n _startScreenMessage: string | null,\n _hideStartScreen: boolean | null,\n ): Promise<Record<string, string | undefined>> {\n const token = requireDeveloperToken(developerToken);\n const music = await configureMusicKit(token);\n if (music.isAuthorized) {\n return {\n status: 'authorized',\n musicUserToken: extractMusicUserToken(music),\n };\n }\n try {\n const result = await music.authorize();\n const musicAfter = await getMusicKitInstance();\n const status = authStatusFromMusicKit(musicAfter, result);\n const resolvedStatus = status ?? 'unknown';\n return {\n status: resolvedStatus,\n musicUserToken:\n resolvedStatus === 'authorized'\n ? extractMusicUserToken(musicAfter, result)\n : undefined,\n };\n } catch (error) {\n return { status: authStatusFromAuthorizeError(error) };\n }\n },\n\n checkSubscription: (musicUserToken: string) => subscription.checkSubscription(musicUserToken),\n\n async getStorefront(musicUserToken: string) {\n const id = await api.getStorefront(musicUserToken);\n return BridgeResponses.storefront(id);\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { WebAppleMusicApiClient } from '../../web/WebAppleMusicApiClient';
|
|
2
|
+
export declare function createCatalogBridge(api: WebAppleMusicApiClient): {
|
|
3
|
+
catalogSearch(term: string, types: string[], options: Record<string, unknown>): Promise<import("../bridge-responses").CatalogSearchPayload>;
|
|
4
|
+
getCatalogSong: (id: string) => Promise<Record<string, unknown>>;
|
|
5
|
+
getCatalogAlbum: (id: string) => Promise<Record<string, unknown>>;
|
|
6
|
+
getCatalogArtist: (id: string) => Promise<Record<string, unknown>>;
|
|
7
|
+
getCatalogPlaylist: (id: string) => Promise<Record<string, unknown>>;
|
|
8
|
+
getCatalogStation: (id: string) => Promise<Record<string, unknown>>;
|
|
9
|
+
getCatalogMusicVideo: (id: string) => Promise<Record<string, unknown>>;
|
|
10
|
+
getCatalogAlbumTracks(albumId: string, options: Record<string, unknown>): Promise<{
|
|
11
|
+
songs: unknown[];
|
|
12
|
+
}>;
|
|
13
|
+
getCatalogArtistAlbums(artistId: string, options: Record<string, unknown>): Promise<{
|
|
14
|
+
albums: unknown[];
|
|
15
|
+
}>;
|
|
16
|
+
getCatalogPlaylistTracks(playlistId: string, options: Record<string, unknown>): Promise<{
|
|
17
|
+
songs: unknown[];
|
|
18
|
+
}>;
|
|
19
|
+
getCatalogCharts(types: string[], options: Record<string, unknown>): Promise<import("../bridge-responses").CatalogChartsPayload>;
|
|
20
|
+
getCatalogResources(type: string, ids: string[]): Promise<{
|
|
21
|
+
musicVideos: unknown[];
|
|
22
|
+
} | {
|
|
23
|
+
songs: unknown[];
|
|
24
|
+
} | {
|
|
25
|
+
albums: unknown[];
|
|
26
|
+
} | {
|
|
27
|
+
artists: unknown[];
|
|
28
|
+
} | {
|
|
29
|
+
playlists: unknown[];
|
|
30
|
+
} | {
|
|
31
|
+
stations: unknown[];
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=catalog-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-bridge.d.ts","sourceRoot":"","sources":["../../../src/bridge/handlers/catalog-bridge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAG/E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,sBAAsB;wBAEjC,MAAM,SAAS,MAAM,EAAE,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;yBAM9D,MAAM;0BACL,MAAM;2BACL,MAAM;6BACJ,MAAM;4BACP,MAAM;+BACH,MAAM;mCAEI,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;qCAMtC,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;yCAMpC,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;4BAMrD,MAAM,EAAE,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;8BAYxC,MAAM,OAAO,MAAM,EAAE;;;;;;;;;;;;;EAoBxD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { paginationFromMap } from '../../web/pagination';
|
|
2
|
+
import * as errors from '../../web/apple-music-errors';
|
|
3
|
+
import { BridgeResponses } from '../bridge-responses';
|
|
4
|
+
export function createCatalogBridge(api) {
|
|
5
|
+
return {
|
|
6
|
+
async catalogSearch(term, types, options) {
|
|
7
|
+
const pagination = paginationFromMap(options);
|
|
8
|
+
const result = await api.catalogSearch(term, types, pagination.limit, pagination.offset);
|
|
9
|
+
return BridgeResponses.catalogSearch(result);
|
|
10
|
+
},
|
|
11
|
+
getCatalogSong: (id) => api.getCatalogSong(id),
|
|
12
|
+
getCatalogAlbum: (id) => api.getCatalogAlbum(id),
|
|
13
|
+
getCatalogArtist: (id) => api.getCatalogArtist(id),
|
|
14
|
+
getCatalogPlaylist: (id) => api.getCatalogPlaylist(id),
|
|
15
|
+
getCatalogStation: (id) => api.getCatalogStation(id),
|
|
16
|
+
getCatalogMusicVideo: (id) => api.getCatalogMusicVideo(id),
|
|
17
|
+
async getCatalogAlbumTracks(albumId, options) {
|
|
18
|
+
const pagination = paginationFromMap(options);
|
|
19
|
+
const songs = await api.getCatalogAlbumTracks(albumId, pagination.limit, pagination.offset);
|
|
20
|
+
return BridgeResponses.songs(songs);
|
|
21
|
+
},
|
|
22
|
+
async getCatalogArtistAlbums(artistId, options) {
|
|
23
|
+
const pagination = paginationFromMap(options);
|
|
24
|
+
const albums = await api.getCatalogArtistAlbums(artistId, pagination.limit, pagination.offset);
|
|
25
|
+
return BridgeResponses.albums(albums);
|
|
26
|
+
},
|
|
27
|
+
async getCatalogPlaylistTracks(playlistId, options) {
|
|
28
|
+
const pagination = paginationFromMap(options);
|
|
29
|
+
const songs = await api.getCatalogPlaylistTracks(playlistId, pagination.limit, pagination.offset);
|
|
30
|
+
return BridgeResponses.songs(songs);
|
|
31
|
+
},
|
|
32
|
+
async getCatalogCharts(types, options) {
|
|
33
|
+
const pagination = paginationFromMap(options);
|
|
34
|
+
const result = await api.getCatalogCharts(types, pagination.limit, pagination.offset, options.genre ?? null, options.chart ?? null);
|
|
35
|
+
return BridgeResponses.catalogCharts(result);
|
|
36
|
+
},
|
|
37
|
+
async getCatalogResources(type, ids) {
|
|
38
|
+
const items = await api.getCatalogResources(type, ids);
|
|
39
|
+
switch (type) {
|
|
40
|
+
case 'songs':
|
|
41
|
+
return BridgeResponses.songs(items);
|
|
42
|
+
case 'albums':
|
|
43
|
+
return BridgeResponses.albums(items);
|
|
44
|
+
case 'artists':
|
|
45
|
+
return BridgeResponses.artists(items);
|
|
46
|
+
case 'playlists':
|
|
47
|
+
return BridgeResponses.playlists(items);
|
|
48
|
+
case 'stations':
|
|
49
|
+
return BridgeResponses.stations(items);
|
|
50
|
+
case 'music-videos':
|
|
51
|
+
return BridgeResponses.musicVideos(items);
|
|
52
|
+
default:
|
|
53
|
+
throw errors.unknownMediaType(type);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=catalog-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-bridge.js","sourceRoot":"","sources":["../../../src/bridge/handlers/catalog-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,UAAU,mBAAmB,CAAC,GAA2B;IAC7D,OAAO;QACL,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,KAAe,EAAE,OAAgC;YACjF,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;YACzF,OAAO,eAAe,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;QAED,cAAc,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,GAAG,CAAC,cAA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cesContent":["import { paginationFromMap } from '../../web/pagination';\nimport * as errors from '../../web/apple-music-errors';\nimport type { WebAppleMusicApiClient } from '../../web/WebAppleMusicApiClient';\nimport { BridgeResponses } from '../bridge-responses';\n\nexport function createCatalogBridge(api: WebAppleMusicApiClient) {\n return {\n async catalogSearch(term: string, types: string[], options: Record<string, unknown>) {\n const pagination = paginationFromMap(options);\n const result = await api.catalogSearch(term, types, pagination.limit, pagination.offset);\n return BridgeResponses.catalogSearch(result);\n },\n\n getCatalogSong: (id: string) => api.getCatalogSong(id),\n getCatalogAlbum: (id: string) => api.getCatalogAlbum(id),\n getCatalogArtist: (id: string) => api.getCatalogArtist(id),\n getCatalogPlaylist: (id: string) => api.getCatalogPlaylist(id),\n getCatalogStation: (id: string) => api.getCatalogStation(id),\n getCatalogMusicVideo: (id: string) => api.getCatalogMusicVideo(id),\n\n async getCatalogAlbumTracks(albumId: string, options: Record<string, unknown>) {\n const pagination = paginationFromMap(options);\n const songs = await api.getCatalogAlbumTracks(albumId, pagination.limit, pagination.offset);\n return BridgeResponses.songs(songs);\n },\n\n async getCatalogArtistAlbums(artistId: string, options: Record<string, unknown>) {\n const pagination = paginationFromMap(options);\n const albums = await api.getCatalogArtistAlbums(artistId, pagination.limit, pagination.offset);\n return BridgeResponses.albums(albums);\n },\n\n async getCatalogPlaylistTracks(playlistId: string, options: Record<string, unknown>) {\n const pagination = paginationFromMap(options);\n const songs = await api.getCatalogPlaylistTracks(playlistId, pagination.limit, pagination.offset);\n return BridgeResponses.songs(songs);\n },\n\n async getCatalogCharts(types: string[], options: Record<string, unknown>) {\n const pagination = paginationFromMap(options);\n const result = await api.getCatalogCharts(\n types,\n pagination.limit,\n pagination.offset,\n (options.genre as string | undefined) ?? null,\n (options.chart as string | undefined) ?? null,\n );\n return BridgeResponses.catalogCharts(result);\n },\n\n async getCatalogResources(type: string, ids: string[]) {\n const items = await api.getCatalogResources(type, ids);\n switch (type) {\n case 'songs':\n return BridgeResponses.songs(items);\n case 'albums':\n return BridgeResponses.albums(items);\n case 'artists':\n return BridgeResponses.artists(items);\n case 'playlists':\n return BridgeResponses.playlists(items);\n case 'stations':\n return BridgeResponses.stations(items);\n case 'music-videos':\n return BridgeResponses.musicVideos(items);\n default:\n throw errors.unknownMediaType(type);\n }\n },\n };\n}\n"]}
|