lx-source-type 2.0.3 → 2.0.4
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 +1 -1
- package/type.d.ts +63 -67
package/package.json
CHANGED
package/type.d.ts
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import type { WithImplicitCoercion } from "node:buffer"
|
|
2
|
+
import type { BinaryLike } from "node:crypto"
|
|
2
3
|
import type Zlib from "node:zlib"
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* LX Music 自定义源 API 类型定义
|
|
6
7
|
*/
|
|
7
8
|
export declare namespace LX {
|
|
8
|
-
export type Quality = "128k" | "320k" | "flac" | "flac24bit"
|
|
9
|
-
export type NetAction = "musicUrl" | "lyric" | "pic"
|
|
10
9
|
export type SupportPlatform = "kw" | "kg" | "tx" | "wy" | "mg" | "local"
|
|
10
|
+
export type NetAction = "musicUrl" | "lyric" | "pic"
|
|
11
|
+
export type Quality = "128k" | "320k" | "flac" | "flac24bit"
|
|
12
|
+
|
|
13
|
+
/** 当前脚本信息 */
|
|
14
|
+
export interface ScriptInfo {
|
|
15
|
+
name: string
|
|
16
|
+
description: string
|
|
17
|
+
version: string
|
|
18
|
+
author: string
|
|
19
|
+
homepage: string
|
|
20
|
+
rawScript: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface EVENT_NAMES {
|
|
24
|
+
inited: "inited"
|
|
25
|
+
request: "request"
|
|
26
|
+
updateAlert: "updateAlert"
|
|
27
|
+
}
|
|
11
28
|
|
|
12
29
|
export interface MusicInfo {
|
|
13
30
|
name: string
|
|
@@ -28,30 +45,30 @@ export declare namespace LX {
|
|
|
28
45
|
[key: string]: any
|
|
29
46
|
}
|
|
30
47
|
|
|
48
|
+
export interface ProviderParams {
|
|
49
|
+
source: SupportPlatform
|
|
50
|
+
action: NetAction
|
|
51
|
+
info: {
|
|
52
|
+
type?: Quality | null
|
|
53
|
+
musicInfo: MusicInfo
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
31
57
|
export interface LyricResult {
|
|
32
58
|
lyric: string
|
|
33
59
|
tlyric?: string | null
|
|
34
60
|
rlyric?: string | null
|
|
35
61
|
lxlyric?: string | null
|
|
36
62
|
}
|
|
63
|
+
|
|
64
|
+
export type ProviderResult = string | LyricResult
|
|
37
65
|
|
|
38
|
-
export interface
|
|
39
|
-
|
|
40
|
-
method?: string
|
|
41
|
-
headers?: Record<string, string>
|
|
42
|
-
body?: any
|
|
43
|
-
form?: Record<string, any>
|
|
44
|
-
formData?: Record<string, any>
|
|
45
|
-
timeout?: number
|
|
66
|
+
export interface Provider {
|
|
67
|
+
(params: ProviderParams): Promise<ProviderResult>
|
|
46
68
|
}
|
|
47
69
|
|
|
48
|
-
export interface
|
|
49
|
-
|
|
50
|
-
statusMessage: string
|
|
51
|
-
headers: Record<string, string | string[] | undefined>
|
|
52
|
-
bytes?: number,
|
|
53
|
-
raw?: Uint8Array,
|
|
54
|
-
body: any
|
|
70
|
+
export interface OnEvent {
|
|
71
|
+
(eventName: EVENT_NAMES["request"], handler: Provider): Promise<void>
|
|
55
72
|
}
|
|
56
73
|
|
|
57
74
|
export interface SourceInfo {
|
|
@@ -71,30 +88,40 @@ export declare namespace LX {
|
|
|
71
88
|
updateUrl?: string
|
|
72
89
|
}
|
|
73
90
|
|
|
74
|
-
export interface
|
|
75
|
-
(
|
|
91
|
+
export interface SendEvent {
|
|
92
|
+
(eventName: EVENT_NAMES["inited"], data: InitedPayload): Promise<void>
|
|
93
|
+
(eventName: EVENT_NAMES["updateAlert"], data: UpdateAlertPayload): Promise<void>
|
|
76
94
|
}
|
|
77
95
|
|
|
78
|
-
export interface
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
export interface RequestOptions {
|
|
97
|
+
/** 默认为 Get */
|
|
98
|
+
method?: string
|
|
99
|
+
headers?: Record<string, string>
|
|
100
|
+
body?: any
|
|
101
|
+
form?: Record<string, any>
|
|
102
|
+
formData?: Record<string, any>
|
|
103
|
+
timeout?: number
|
|
85
104
|
}
|
|
86
|
-
|
|
87
|
-
export
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
|
|
106
|
+
export interface RequestResponse {
|
|
107
|
+
statusCode: number
|
|
108
|
+
statusMessage: string
|
|
109
|
+
headers: Record<string, string | string[] | undefined>
|
|
110
|
+
bytes?: number,
|
|
111
|
+
raw?: Uint8Array,
|
|
112
|
+
body: any
|
|
92
113
|
}
|
|
93
114
|
|
|
94
|
-
export interface
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
115
|
+
export interface RequestCallback {
|
|
116
|
+
(err: any, resp: RequestResponse | null, body: any): void
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface Request {
|
|
120
|
+
(
|
|
121
|
+
url: string,
|
|
122
|
+
options: RequestOptions,
|
|
123
|
+
callback: RequestCallback
|
|
124
|
+
): () => void
|
|
98
125
|
}
|
|
99
126
|
|
|
100
127
|
export interface Utils {
|
|
@@ -115,37 +142,6 @@ export declare namespace LX {
|
|
|
115
142
|
}
|
|
116
143
|
}
|
|
117
144
|
|
|
118
|
-
/** 当前脚本信息 */
|
|
119
|
-
export interface ScriptInfo {
|
|
120
|
-
name: string
|
|
121
|
-
description: string
|
|
122
|
-
version: string
|
|
123
|
-
author: string
|
|
124
|
-
homepage: string
|
|
125
|
-
rawScript: string
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface RequestCallback {
|
|
129
|
-
(err: any, resp: RequestResponse | null, body: any): void
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface OnEvent {
|
|
133
|
-
(eventName: EVENT_NAMES["request"], handler: Provider): Promise<void>
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface SendEvent {
|
|
137
|
-
(eventName: EVENT_NAMES["inited"], data: InitedPayload): Promise<void>
|
|
138
|
-
(eventName: EVENT_NAMES["updateAlert"], data: UpdateAlertPayload): Promise<void>
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface Request {
|
|
142
|
-
(
|
|
143
|
-
url: string,
|
|
144
|
-
options: RequestOptions,
|
|
145
|
-
callback: RequestCallback
|
|
146
|
-
): () => void
|
|
147
|
-
}
|
|
148
|
-
|
|
149
145
|
export interface API {
|
|
150
146
|
/** API 版本号 */
|
|
151
147
|
version: "2.0.0"
|