@naplink/naplink 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 NapLink Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # NapLink
2
+
3
+ > 现代化的 NapCat WebSocket 客户端 SDK
4
+
5
+ [![npm version](https://img.shields.io/npm/v/naplink)](https://www.npmjs.com/package/naplink)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.4+-blue)](https://www.typescriptlang.org/)
7
+ [![Node.js](https://img.shields.io/badge/Node.js-18+-green)](https://nodejs.org/)
8
+ [![Documentation](https://img.shields.io/badge/docs-naplink.github.io-blue)](https://naplink.github.io/)
9
+ [![License](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
10
+
11
+ ## ✨ 特性
12
+
13
+ - 🚀 **现代化设计** - TypeScript + ES2022,完整类型定义
14
+ - 🔄 **智能重连** - 指数退避重连机制,自动故障恢复
15
+ - ⏱️ **超时控制** - API 调用和连接超时保护
16
+ - 🎯 **事件驱动** - 完整的 OneBot 11 事件支持
17
+ - 📊 **完善日志** - 分级日志系统,支持自定义 logger
18
+ - 💪 **稳定可靠** - 自动心跳检测,零运行时依赖
19
+
20
+ ## 📚 文档
21
+
22
+ 完整文档请访问:**[https://naplink.github.io/](https://naplink.github.io/)**
23
+
24
+ - [快速开始](https://naplink.github.io/guide/getting-started) - 5分钟上手
25
+ - [API 文档](https://naplink.github.io/api/naplink) - 完整 API 参考
26
+ - [配置选项](https://naplink.github.io/guide/configuration) - 详细配置说明
27
+ - [事件处理](https://naplink.github.io/guide/events) - 事件系统详解
28
+ - [最佳实践](https://naplink.github.io/guide/best-practices) - 生产环境建议
29
+ - [架构设计](https://naplink.github.io/guide/architecture) - 内部实现
30
+
31
+ ## 📦 安装
32
+
33
+ ```bash
34
+ npm install naplink
35
+ # 或
36
+ pnpm add naplink
37
+ # 或
38
+ yarn add naplink
39
+ ```
40
+
41
+ ## 🔧 配置示例
42
+
43
+ ```typescript
44
+ const client = new NapLink({
45
+ connection: {
46
+ url: 'ws://localhost:3001',
47
+ timeout: 30000, // 连接超时
48
+ pingInterval: 30000, // 心跳间隔
49
+ },
50
+ reconnect: {
51
+ enabled: true, // 启用自动重连
52
+ maxAttempts: 10, // 最大重连次数
53
+ },
54
+ logging: {
55
+ level: 'info', // 日志级别
56
+ },
57
+ api: {
58
+ timeout: 30000, // API 超时
59
+ retries: 3, // 重试次数
60
+ },
61
+ });
62
+ ```
63
+
64
+ 更多配置选项请查看 [配置文档](https://naplink.github.io/guide/configuration)。
65
+
66
+ ## 🏗️ 开发
67
+
68
+ ```bash
69
+ # 安装依赖
70
+ npm install
71
+
72
+ # 开发模式
73
+ npm run dev
74
+
75
+ # 构建
76
+ npm run build
77
+
78
+ # 测试
79
+ npm test
80
+
81
+ # 类型检查
82
+ npm run typecheck
83
+ ```
84
+
85
+ ## 📄 许可证
86
+
87
+ [MIT](./LICENSE)
88
+
89
+ ## 🙏 致谢
90
+
91
+ - [NapCat](https://napneko.github.io/) - 优秀的 QQ Bot 框架
92
+ - [OneBot 11](https://github.com/botuniverse/onebot-11) - 标准化 Bot 协议
93
+ - [node-napcat-ts](https://github.com/HkTeamX/node-napcat-ts) - 灵感来源
94
+
95
+ **NapLink** - 让 NapCat 开发更简单 ✨