@any-listen/extension-kit 0.1.4 → 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.4",
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,12 +662,13 @@ 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
  }
668
+ interface SonglistTagResult {
669
+ tags: AnyListen.Resource.TagGroupItem[]
670
+ hotTags: AnyListen.Resource.TagItem[]
671
+ }
651
672
  interface SonglistListParams extends CommonListParams {
652
673
  sort: string
653
674
  tag: string
@@ -655,13 +676,16 @@ interface SonglistListParams extends CommonListParams {
655
676
  interface SonglistDetailResult extends ListCommonResult<AnyListen.Music.MusicInfoOnline> {
656
677
  info: AnyListen.Resource.SongListDetailInfo
657
678
  }
658
- interface LeaderboardDateParams extends CommonParams {
679
+ interface TopSongsDateParams extends CommonParams {
659
680
  id: string
660
681
  }
661
- interface LeaderboardDetailParams extends CommonListParams {
682
+ interface TopSongsDetailParams extends CommonListParams {
662
683
  id: string
663
684
  date: string
664
685
  }
686
+ interface TopSongsDetailResult extends ListCommonResult<AnyListen.Music.MusicInfoOnline> {
687
+ info: AnyListen.Resource.TopSongsDetailInfo
688
+ }
665
689
  interface MusicCommentParams extends CommonListParams {
666
690
  musicInfo: AnyListen.Music.MusicInfoOnline
667
691
  id?: string
@@ -749,7 +773,8 @@ declare global {
749
773
  type CommonItem = AnyListen.Resource.CommonItem
750
774
  type TagItem = AnyListen.Resource.TagItem
751
775
  type TagGroupItem = AnyListen.Resource.TagGroupItem
752
- type BoardItem = AnyListen.Resource.BoardItem
776
+ type TopSongsItem = AnyListen.Resource.TopSongsItem
777
+ type TopSongsDetailInfo = AnyListen.Resource.TopSongsDetailInfo
753
778
 
754
779
  type ParamsData = Record<string, string | number | null | undefined | boolean>
755
780
  interface RequestOptions {
@@ -985,9 +1010,9 @@ declare global {
985
1010
  */
986
1011
  listId: string
987
1012
  /**
988
- * 是否在线列表
1013
+ * 列表类型
989
1014
  */
990
- isOnline: boolean
1015
+ source: AnyListen.List.SourceType
991
1016
  /**
992
1017
  * 是否属于 “稍后播放”
993
1018
  */
@@ -1043,7 +1068,7 @@ declare global {
1043
1068
  type MusicSearchResult = ListCommonResult<AnyListen.Music.MusicInfoOnline>
1044
1069
 
1045
1070
  interface ResourceAction {
1046
- tipSearch: (params: CommonParams) => Promise<string[]>
1071
+ tipSearch: (params: TipSearchParams) => Promise<string[]>
1047
1072
  hotSearch: (params: CommonParams) => Promise<string[]>
1048
1073
  musicSearch: (params: MusicSearchParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
1049
1074
  musicPic: (params: MusicCommonParams) => Promise<string>
@@ -1052,14 +1077,14 @@ declare global {
1052
1077
  musicPicSearch: (params: PicSearchParams) => Promise<string[]>
1053
1078
  lyricSearch: (params: LyricSearchParams) => Promise<LyricSearchResult[]>
1054
1079
  lyricDetail: (params: LyricDetailParams) => Promise<AnyListen.Music.LyricInfo>
1055
- songlistSearch: (params: SonglistSearchParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1080
+ songlistSearch: (params: CommonSearchParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1056
1081
  songlistSorts: (params: CommonParams) => Promise<AnyListen.Resource.TagItem[]>
1057
- songlistTags: (params: CommonParams) => Promise<AnyListen.Resource.TagGroupItem[]>
1082
+ songlistTags: (params: CommonParams) => Promise<SonglistTagResult>
1058
1083
  songlist: (params: SonglistListParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1059
1084
  songlistDetail: (params: ListDetailParams) => Promise<SonglistDetailResult>
1060
- leaderboard: (params: CommonParams) => Promise<AnyListen.Resource.TagGroupItem[]>
1061
- leaderboardDate: (params: LeaderboardDateParams) => Promise<AnyListen.Resource.TagItem[]>
1062
- 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>
1063
1088
  musicComment: (params: MusicCommentParams) => Promise<ListCommonResult<MusicComment>>
1064
1089
  }
1065
1090
 
@@ -1095,7 +1120,20 @@ declare global {
1095
1120
  key: Uint8Array | string,
1096
1121
  iv: Uint8Array | string
1097
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>
1098
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>
1099
1137
  randomBytes: (size: number) => Promise<Uint8Array>
1100
1138
  md5: (text: string | Uint8Array) => Promise<string>
1101
1139
  sha1: (text: string | Uint8Array) => Promise<string>