@any-listen/extension-kit 0.1.5 → 0.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@any-listen/extension-kit",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "keywords": [
5
5
  "any-listen",
6
6
  "any-listen-extension"
@@ -8,7 +8,7 @@ type ResourceAction =
8
8
  | 'musicUrl'
9
9
  | 'songlistSearch'
10
10
  | 'songlist'
11
- | 'leaderboard'
11
+ | 'topSongs'
12
12
  | 'albumSearch'
13
13
  | 'album'
14
14
  | 'singerSearch'
@@ -12,6 +12,8 @@ declare namespace AnyListen {
12
12
  type AddMusicLocationType = 'top' | 'bottom'
13
13
 
14
14
  namespace Player {
15
+ type SourceType = 'local' | 'songlist' | 'topSongs' | 'search' | 'album'
16
+
15
17
  interface MusicInfo {
16
18
  id: string | null
17
19
  pic: string | null | undefined
@@ -41,9 +43,9 @@ declare namespace AnyListen {
41
43
  */
42
44
  listId: string
43
45
  /**
44
- * 是否在线列表
46
+ * 列表类型
45
47
  */
46
- isOnline: boolean
48
+ source: SourceType
47
49
  /**
48
50
  * 是否属于 “稍后播放”
49
51
  */
@@ -58,7 +60,7 @@ declare namespace AnyListen {
58
60
  duration: number
59
61
  index: number
60
62
  listId: string | null
61
- isOnline: boolean
63
+ source: SourceType
62
64
  historyIndex: number
63
65
  }
64
66
 
@@ -190,12 +192,15 @@ declare namespace AnyListen {
190
192
  enabledRemove?: boolean
191
193
  usePolling?: boolean
192
194
  }
195
+ type SourceType = 'songlist' | 'topSongs' | 'search' | 'album'
193
196
  interface UserListInfoByOnlineMeta extends UserListInfoBaseMeta {
194
197
  extensionId: string
195
198
  source: string
196
199
  syncId: string
197
200
  syncTime: number
198
201
  picUrl: string | null
202
+ sourceType: SourceType
203
+ [key: string]: unknown
199
204
  }
200
205
  interface UserListInfoByRemoteMeta extends UserListInfoBaseMeta {
201
206
  extensionId: string
@@ -491,7 +496,7 @@ declare namespace AnyListen {
491
496
  interface PlayerActionSet {
492
497
  listId: string | null
493
498
  list: Player.PlayMusicInfo[]
494
- isOnline: boolean
499
+ source: List.SourceType
495
500
  isSync?: boolean
496
501
  }
497
502
  interface PlayerActionAdd {
@@ -563,7 +568,7 @@ declare namespace AnyListen {
563
568
  info: SavedPlayInfo
564
569
  list: Player.PlayMusicInfo[]
565
570
  listId: string | null
566
- isOnline: boolean
571
+ source: List.SourceType
567
572
  historyList: PlayHistoryListItem[]
568
573
  isCollect: boolean
569
574
  }
@@ -587,6 +592,7 @@ declare namespace AnyListen {
587
592
  desc?: string
588
593
  author?: string
589
594
  play_count?: string
595
+ date?: string
590
596
  }
591
597
 
592
598
  interface CommonItem {
@@ -599,7 +605,15 @@ declare namespace AnyListen {
599
605
  list: CommonItem[]
600
606
  }
601
607
 
602
- type BoardItem = CommonItem
608
+ interface TopSongsItem extends CommonItem {
609
+ pic?: string
610
+ }
611
+ interface TopSongsDetailInfo {
612
+ name: string
613
+ pic?: string
614
+ desc?: string
615
+ date?: string
616
+ }
603
617
  }
604
618
  }
605
619
 
@@ -617,6 +631,12 @@ interface CommonListParams extends CommonParams {
617
631
  page: number
618
632
  limit: number
619
633
  }
634
+ interface CommonSearchParams extends CommonListParams {
635
+ keyword: string
636
+ }
637
+ interface TipSearchParams extends CommonParams {
638
+ keyword: string
639
+ }
620
640
  interface MusicSearchParams extends CommonListParams {
621
641
  name: string
622
642
  artist?: string
@@ -642,9 +662,6 @@ interface PicSearchParams extends CommonParams {
642
662
  artist?: string
643
663
  interval?: number
644
664
  }
645
- interface SonglistSearchParams extends CommonListParams {
646
- keyword: string
647
- }
648
665
  interface ListDetailParams extends CommonListParams {
649
666
  id: string
650
667
  }
@@ -659,13 +676,16 @@ interface SonglistListParams extends CommonListParams {
659
676
  interface SonglistDetailResult extends ListCommonResult<AnyListen.Music.MusicInfoOnline> {
660
677
  info: AnyListen.Resource.SongListDetailInfo
661
678
  }
662
- interface LeaderboardDateParams extends CommonParams {
679
+ interface TopSongsDateParams extends CommonParams {
663
680
  id: string
664
681
  }
665
- interface LeaderboardDetailParams extends CommonListParams {
682
+ interface TopSongsDetailParams extends CommonListParams {
666
683
  id: string
667
684
  date: string
668
685
  }
686
+ interface TopSongsDetailResult extends ListCommonResult<AnyListen.Music.MusicInfoOnline> {
687
+ info: AnyListen.Resource.TopSongsDetailInfo
688
+ }
669
689
  interface MusicCommentParams extends CommonListParams {
670
690
  musicInfo: AnyListen.Music.MusicInfoOnline
671
691
  id?: string
@@ -753,7 +773,8 @@ declare global {
753
773
  type CommonItem = AnyListen.Resource.CommonItem
754
774
  type TagItem = AnyListen.Resource.TagItem
755
775
  type TagGroupItem = AnyListen.Resource.TagGroupItem
756
- type BoardItem = AnyListen.Resource.BoardItem
776
+ type TopSongsItem = AnyListen.Resource.TopSongsItem
777
+ type TopSongsDetailInfo = AnyListen.Resource.TopSongsDetailInfo
757
778
 
758
779
  type ParamsData = Record<string, string | number | null | undefined | boolean>
759
780
  interface RequestOptions {
@@ -989,9 +1010,9 @@ declare global {
989
1010
  */
990
1011
  listId: string
991
1012
  /**
992
- * 是否在线列表
1013
+ * 列表类型
993
1014
  */
994
- isOnline: boolean
1015
+ source: AnyListen.List.SourceType
995
1016
  /**
996
1017
  * 是否属于 “稍后播放”
997
1018
  */
@@ -1047,7 +1068,7 @@ declare global {
1047
1068
  type MusicSearchResult = ListCommonResult<AnyListen.Music.MusicInfoOnline>
1048
1069
 
1049
1070
  interface ResourceAction {
1050
- tipSearch: (params: CommonParams) => Promise<string[]>
1071
+ tipSearch: (params: TipSearchParams) => Promise<string[]>
1051
1072
  hotSearch: (params: CommonParams) => Promise<string[]>
1052
1073
  musicSearch: (params: MusicSearchParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
1053
1074
  musicPic: (params: MusicCommonParams) => Promise<string>
@@ -1056,14 +1077,14 @@ declare global {
1056
1077
  musicPicSearch: (params: PicSearchParams) => Promise<string[]>
1057
1078
  lyricSearch: (params: LyricSearchParams) => Promise<LyricSearchResult[]>
1058
1079
  lyricDetail: (params: LyricDetailParams) => Promise<AnyListen.Music.LyricInfo>
1059
- songlistSearch: (params: SonglistSearchParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1080
+ songlistSearch: (params: CommonSearchParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1060
1081
  songlistSorts: (params: CommonParams) => Promise<AnyListen.Resource.TagItem[]>
1061
1082
  songlistTags: (params: CommonParams) => Promise<SonglistTagResult>
1062
1083
  songlist: (params: SonglistListParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1063
1084
  songlistDetail: (params: ListDetailParams) => Promise<SonglistDetailResult>
1064
- leaderboard: (params: CommonParams) => Promise<AnyListen.Resource.TagGroupItem[]>
1065
- leaderboardDate: (params: LeaderboardDateParams) => Promise<AnyListen.Resource.TagItem[]>
1066
- leaderboardDetail: (params: LeaderboardDetailParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
1085
+ topSongs: (params: CommonParams) => Promise<AnyListen.Resource.TopSongsItem[]>
1086
+ topSongsDate: (params: TopSongsDateParams) => Promise<AnyListen.Resource.TagItem[]>
1087
+ topSongsDetail: (params: TopSongsDetailParams) => Promise<TopSongsDetailResult>
1067
1088
  musicComment: (params: MusicCommentParams) => Promise<ListCommonResult<MusicComment>>
1068
1089
  }
1069
1090
 
@@ -1099,7 +1120,20 @@ declare global {
1099
1120
  key: Uint8Array | string,
1100
1121
  iv: Uint8Array | string
1101
1122
  ) => Promise<string>
1123
+ aesDecrypt: <T extends 'base64' | 'binary' | 'utf-8' = 'binary'>(
1124
+ mode: AES_MODE,
1125
+ data: Uint8Array | string,
1126
+ key: Uint8Array | string,
1127
+ iv: Uint8Array | string,
1128
+ encoding?: T
1129
+ ) => Promise<T extends 'binary' ? Uint8Array : string>
1102
1130
  rsaEncrypt: (mode: RSA_PADDING, data: Uint8Array, key: Uint8Array) => Promise<string>
1131
+ rsaDecrypt: <T extends 'base64' | 'binary' | 'utf-8' = 'binary'>(
1132
+ mode: RSA_PADDING,
1133
+ data: Uint8Array,
1134
+ key: Uint8Array,
1135
+ encoding?: T
1136
+ ) => Promise<T extends 'binary' ? Uint8Array : string>
1103
1137
  randomBytes: (size: number) => Promise<Uint8Array>
1104
1138
  md5: (text: string | Uint8Array) => Promise<string>
1105
1139
  sha1: (text: string | Uint8Array) => Promise<string>