@laplace.live/internal 1.2.57 → 1.3.1

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,7 +1,11 @@
1
1
  {
2
2
  "name": "@laplace.live/internal",
3
- "version": "1.2.57",
4
- "module": "index.d.ts",
3
+ "version": "1.3.1",
4
+ "module": "src/index.d.ts",
5
+ "exports": {
6
+ ".": "./src/index.d.ts",
7
+ "./*": "./src/const/*.ts"
8
+ },
5
9
  "devDependencies": {
6
10
  "@types/bun": "latest"
7
11
  },
@@ -0,0 +1,124 @@
1
+ /** Used for brain-fucked bilibili devs */
2
+ export type StringBoolean = 'true' | 'false'
3
+
4
+ /** Emote list */
5
+ export interface SimpleEmotesList {
6
+ [key: string]: SimpleEmote
7
+ }
8
+
9
+ /**
10
+ * Used by bmotes and remote emotes
11
+ */
12
+ export interface SimpleEmote {
13
+ url: string
14
+ width?: number
15
+ height?: number
16
+ }
17
+
18
+ /**
19
+ * 用于 `DANMU` 事件中 @ 用户回复的 type
20
+ * Used by:
21
+ * - chat.laplace.chat
22
+ */
23
+ export interface DanmakuReplyProps {
24
+ uid: number
25
+ uname: string
26
+ }
27
+
28
+ /**
29
+ * LAPLACE fans medal
30
+ */
31
+ export interface FansMedal {
32
+ /**
33
+ * 当没佩戴粉丝勋章时,返回 0
34
+ */
35
+ level: number
36
+ /**
37
+ * 当没佩戴粉丝勋章时,返回空字符串
38
+ */
39
+ name: string
40
+ /**
41
+ * 当前粉丝勋章的房间号,并不是所有的事件都支持,例如弹幕事件支持,礼物事件就不支持
42
+ *
43
+ * 不支持的时候会返回 0,返回 0 时会影响千舰、万舰的头像框和粉丝勋章图标的判断
44
+ */
45
+ room: number
46
+ /**
47
+ * 此字段通过计算事件中返回的 `uinfo.medal.guard_icon` 而来,不过 guard_icon 并不是
48
+ * 所有的事件都会返回(例如大航海就返回空),因此仅作为兜底使用
49
+ * 目前大航海图标只区分是否千舰,不区分万舰,只有大航海头像框区分
50
+ */
51
+ resolvedPerkLevel?: number
52
+ /**
53
+ * 粉丝勋章图标,千舰、万舰会有区别
54
+ * @link https://i0.hdslb.com/bfs/live/98a201c14a64e860a758f089144dcf3f42e7038c.png
55
+ * @deprecated 直接传 URL 的方式已弃用,会增大事件体积,请使用上方的 `resolvedPerkLevel` 进行判断
56
+ */
57
+ guardIcon?: string
58
+ /**
59
+ * 粉丝牌所对应主播的 UID,当 `type` 为 1 时,此时为粉丝团套票,此处的 UID 等于粉丝团 id😅
60
+ */
61
+ uid?: number
62
+ /** Color in decimal color */
63
+ // colorBorder: number;
64
+ /** Color in decimal color */
65
+ // colorStart: number;
66
+ /** Color in decimal color */
67
+ // colorEnd: number;
68
+ /**
69
+ * 0: 白字
70
+ * 1: 总督
71
+ * 2: 提督
72
+ * 3: 舰长
73
+ */
74
+ guardType: number
75
+ /**
76
+ * 粉丝勋章是否点亮
77
+ *
78
+ * 1: 点亮
79
+ * 0: 未点亮
80
+ */
81
+ lightened: number
82
+ /**
83
+ * 粉丝勋章类型,后加的属性,为了兼容性,因此为可选
84
+ *
85
+ * 0: 普通粉丝牌
86
+ * 1: 大航海套票
87
+ */
88
+ type?: number
89
+ }
90
+
91
+ /**
92
+ * b豆 emote props
93
+ * @deprecated Use `SimpleBmote` instead
94
+ */
95
+ export interface Bmote {
96
+ emoticon_id: number
97
+ emoji: string
98
+ descript: string
99
+ url: string
100
+ width: number
101
+ height: number
102
+ emoticon_unique: string
103
+ count: number
104
+ }
105
+
106
+ /**
107
+ * `buvid` props
108
+ */
109
+ export interface BuvidProps {
110
+ token: string
111
+ }
112
+
113
+ /**
114
+ * Protobuf data from danmu v2 props
115
+ * @deprecated Not bilibili no longer returns protobuf
116
+ */
117
+ export type ProtobufDanmuV2Props = {
118
+ user: {
119
+ face: string
120
+ }
121
+ }
122
+
123
+ /** 内部连接方式 */
124
+ export type ConnectionModes = 'direct' | 'builtin' | 'qrcode' | 'open-platform'
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Steam API language codes for the Store API `l` parameter.
3
+ * @link https://partner.steamgames.com/doc/store/localization/languages
4
+ */
5
+ export const steamLanguages = [
6
+ 'arabic',
7
+ 'brazilian',
8
+ 'bulgarian',
9
+ 'czech',
10
+ 'danish',
11
+ 'dutch',
12
+ 'english',
13
+ 'finnish',
14
+ 'french',
15
+ 'german',
16
+ 'greek',
17
+ 'hungarian',
18
+ 'indonesian',
19
+ 'italian',
20
+ 'japanese',
21
+ 'koreana',
22
+ 'latam',
23
+ 'norwegian',
24
+ 'polish',
25
+ 'portuguese',
26
+ 'romanian',
27
+ 'russian',
28
+ 'schinese',
29
+ 'spanish',
30
+ 'swedish',
31
+ 'tchinese',
32
+ 'thai',
33
+ 'turkish',
34
+ 'ukrainian',
35
+ 'vietnamese',
36
+ ] as const
37
+
38
+ export type SteamLanguage = (typeof steamLanguages)[number]
package/src/index.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The Global LAPLACE typings
3
+ * Maintained by laplace.live
4
+ */
5
+
6
+ export type * from './common'
7
+ export type { Aicu } from './namespaces/aicu'
8
+ export type { Aliyun } from './namespaces/aliyun'
9
+ export type { BilibiliInternal } from './namespaces/bilibili'
10
+ export type { Danmakus } from './namespaces/danmakus'
11
+ export type { Kuaidi100 } from './namespaces/kuaidi100'
12
+ export type { LaplaceInternal } from './namespaces/laplace'
13
+ export type { LoveAvA } from './namespaces/loveava'
14
+ export type { Steam } from './namespaces/steam'
15
+ export type { Vtbs } from './namespaces/vtbs'
16
+ export type { Zeroroku } from './namespaces/zeroroku'
@@ -0,0 +1,120 @@
1
+ /**
2
+ * aicu.cc API
3
+ */
4
+ export declare namespace Aicu {
5
+ /**
6
+ * Root API response
7
+ *
8
+ * @example
9
+ * {
10
+ * code: 0,
11
+ * data: { ... },
12
+ * message: "",
13
+ * ttl: 1
14
+ * }
15
+ * @link https://api.aicu.cc/api/v3/search/getlivedm?uid=32210417&pn=1&ps=100&keyword=
16
+ */
17
+ export interface LiveDm {
18
+ /** Status code, 0 indicates success */
19
+ code: number
20
+
21
+ /** Main payload */
22
+ data: {
23
+ /**
24
+ * List of room + danmu records
25
+ *
26
+ * @example
27
+ * [
28
+ * {
29
+ * roominfo: { ... },
30
+ * danmu: [ ... ]
31
+ * }
32
+ * ]
33
+ */
34
+ list: {
35
+ /**
36
+ * Room metadata
37
+ *
38
+ * @example
39
+ * {
40
+ * upname: "五条悟跳舞",
41
+ * upuid: "32210417",
42
+ * roomid: "2156755",
43
+ * roomname: "让俺移动端看看怎么个事儿"
44
+ * }
45
+ */
46
+ roominfo: {
47
+ /** Streamer display name */
48
+ upname: string
49
+
50
+ /** Streamer UID (stringified number) */
51
+ upuid: string
52
+
53
+ /** Room ID (stringified number) */
54
+ roomid: string
55
+
56
+ /** Room title */
57
+ roomname: string
58
+ }
59
+
60
+ /**
61
+ * Danmu (chat messages) sent in this room
62
+ *
63
+ * @example
64
+ * [
65
+ * { uname: "五条悟跳舞", text: "666", ts: 1766410063 }
66
+ * ]
67
+ */
68
+ danmu: {
69
+ /** Username of the sender */
70
+ uname: string
71
+
72
+ /**
73
+ * Message content
74
+ * Can be plain text or emoticon codes like "[Icomochi_萌萌]"
75
+ */
76
+ text: string
77
+
78
+ /**
79
+ * Unix timestamp (seconds)
80
+ *
81
+ * @example
82
+ * 1767347950
83
+ */
84
+ ts: number
85
+ }[]
86
+ }[]
87
+
88
+ /**
89
+ * Pagination cursor info
90
+ *
91
+ * @example
92
+ * {
93
+ * is_end: false,
94
+ * all_count: 180
95
+ * }
96
+ */
97
+ cursor: {
98
+ /**
99
+ * Whether this is the last page
100
+ *
101
+ * @example false
102
+ */
103
+ is_end: boolean
104
+
105
+ /**
106
+ * Total available records
107
+ *
108
+ * @example 180
109
+ */
110
+ all_count: number
111
+ }
112
+ }
113
+
114
+ /** Optional message, usually empty on success */
115
+ message: string
116
+
117
+ /** Cache TTL in seconds */
118
+ ttl: number
119
+ }
120
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Aliyun API
3
+ */
4
+ export declare namespace Aliyun {
5
+ /**
6
+ * 物流面单信息提取
7
+ * @url https://help.aliyun.com/zh/address-purification/addrpapi/developer-reference/logistics-information-extraction
8
+ */
9
+ export interface ExtractExpress {
10
+ RequestId: string
11
+ /** 正常时返回 */
12
+ Data?: string
13
+ /** 报错时返回 */
14
+ Code?: string
15
+ /** 报错时返回 */
16
+ Message?: string
17
+ /** 报错时返回 */
18
+ HostId?: string
19
+ /** 报错时返回 */
20
+ Recommend?: string
21
+ }
22
+
23
+ /**
24
+ * Need JSON.parse() to get from `ExtractExpress.Data`
25
+ */
26
+ export interface ExtractExpressData {
27
+ /** 提取内容,当传入的地址无效时,会直接返回空对象 */
28
+ express_extract:
29
+ | {
30
+ house_info: string
31
+ poi_info: string
32
+ town: string
33
+ city: string
34
+ district: string
35
+ /** 电话号码 */
36
+ tel: string
37
+ /** 地址信息 */
38
+ addr_info: string
39
+ /** 姓名 */
40
+ per: string
41
+ prov: string
42
+ }
43
+ // biome-ignore lint/complexity/noBannedTypes: expected empty object
44
+ | {}
45
+ /** 状态,'OK',当传入的地址无效时,依然返回 OK 😅 */
46
+ status: string
47
+ /** 算法处理耗时 */
48
+ time_used: {
49
+ rt: {
50
+ basic_chunking: number
51
+ segment: number
52
+ address_correct: number
53
+ complete: number
54
+ express_extract: number
55
+ address_search: number
56
+ structure: number
57
+ }
58
+ start: number
59
+ }
60
+ }
61
+ }