localsbnb-mcp-server 1.0.11 → 1.0.13
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/README.md +129 -150
- package/dist/auth/apiKeyManager.js +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/permissionChecker.js +1 -1
- package/dist/client/cacheManager.js +1 -1
- package/dist/client/httpClient.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/retryHandler.js +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/tools.js +1 -1
- package/dist/index.js +1 -1
- package/dist/package.json +1 -1
- package/dist/server.js +1 -1
- package/dist/start.mjs +1 -1
- package/dist/tools/channels/getChannelDetails.js +1 -1
- package/dist/tools/channels/index.js +1 -1
- package/dist/tools/channels/listChannels.js +1 -1
- package/dist/tools/finance/analyzeRevenue.js +1 -1
- package/dist/tools/finance/index.js +1 -1
- package/dist/tools/finance/queryFinancialData.js +1 -1
- package/dist/tools/finance/queryOperationalData.js +1 -1
- package/dist/tools/finance/queryOperationalDataV2.js +1 -1
- package/dist/tools/orders/cancelOrder.js +1 -1
- package/dist/tools/orders/getOrderDetails.js +1 -1
- package/dist/tools/orders/getOrderDetailsV2.js +1 -1
- package/dist/tools/orders/index.js +1 -1
- package/dist/tools/orders/ordersGetShared.js +1 -1
- package/dist/tools/orders/queryInHouseOrders.js +1 -1
- package/dist/tools/orders/queryOrders.js +1 -1
- package/dist/tools/orders/queryOrdersByDateRange.js +1 -1
- package/dist/tools/orders/queryPreArrivalOrders.js +1 -1
- package/dist/tools/orders/queryPreDepartureOrders.js +1 -1
- package/dist/tools/orders/queryTodayOrders.js +1 -1
- package/dist/tools/rooms/batchUpdatePrices.js +1 -1
- package/dist/tools/rooms/index.js +1 -1
- package/dist/tools/rooms/queryRoomPrices.js +1 -1
- package/dist/tools/rooms/queryRoomStatusNew.js +1 -1
- package/dist/tools/rooms/queryTodayRoomStatus.js +1 -1
- package/dist/tools/rooms/updateRoomPrice.js +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/desensitize.js +1 -1
- package/dist/utils/errorHandler.js +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/price.js +1 -1
- package/dist/utils/shanghaiDate.js +1 -1
- package/dist/utils/validator.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,76 +1,100 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LocalsBnb AI(路客云 MCP 服务)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
LocalsBnb AI 将路客云 PMS 的订单、房态房价、经营分析等核心能力统一封装为 MCP,
|
|
4
|
+
让门店与运营团队在现有沟通入口中即可通过自然语言完成“查询 -> 判断 -> 执行”,减少系统切换、提升协同效率。
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
服务可接入 OpenClaw、Hermes Agent 及任意支持 MCP 的客户端;
|
|
7
|
+
其中 **OpenClaw + 微信** 是当前落地最广、转化效率最高的组合,建议优先作为推广与实施路径。
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 我们是什么
|
|
12
|
+
|
|
13
|
+
LocalsBnb AI 是一层“AI 到路客云 API 的标准连接层”:
|
|
14
|
+
|
|
15
|
+
- 对上:提供统一 MCP 工具能力
|
|
16
|
+
- 对下:调用路客云接口并处理鉴权、错误与权限
|
|
17
|
+
- 对业务:让查询与操作可以直接通过自然语言完成
|
|
18
|
+
|
|
19
|
+
适用对象:门店运营、前台、店长、区域管理、技术实施团队。
|
|
20
|
+
|
|
21
|
+
---
|
|
8
22
|
|
|
9
|
-
|
|
10
|
-
- 「今天有哪些订单?」
|
|
11
|
-
- 「帮我查一下本周的入住率」
|
|
23
|
+
## 我们可以做什么
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
### 核心查询能力(当前可直接落地)
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
- 订单看板:今日预抵 / 在住 / 预离一键汇总,快速识别当日待办
|
|
28
|
+
- 订单详情:按订单号直达详情,减少前台和运营反复翻找
|
|
29
|
+
- 房态与可售:支持今日快照与多日区间查询,适合排班与排房决策
|
|
30
|
+
- 房价数据:支持按日期/自然周查看价格趋势,便于活动与调价判断
|
|
31
|
+
- 经营分析:支持查看入住率、营收等核心指标,用于复盘与晨会
|
|
16
32
|
|
|
17
|
-
###
|
|
18
|
-
- 查询订单列表、订单详情
|
|
19
|
-
- 办理入住 / 退房
|
|
33
|
+
### 管理价值(对门店最直接)
|
|
20
34
|
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- 批量更新价格
|
|
35
|
+
- 把“查数据”从后台页面前移到对话入口,响应更快
|
|
36
|
+
- 一线同学按自然语言提问即可获得可执行结果,培训成本低
|
|
37
|
+
- 统一口径返回订单、房态、经营数据,减少跨角色信息偏差
|
|
25
38
|
|
|
26
|
-
###
|
|
27
|
-
- 查询经营数据、财务数据
|
|
28
|
-
- 收益分析、入住率相关数据
|
|
39
|
+
### 能力边界说明
|
|
29
40
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
- 关联或解绑渠道
|
|
41
|
+
- 当前版本以查询分析能力为主,已覆盖订单、房态、房价、经营数据主链路
|
|
42
|
+
- 写操作能力可按账号权限与部署策略逐步开放
|
|
33
43
|
|
|
34
44
|
---
|
|
35
45
|
|
|
36
|
-
##
|
|
46
|
+
## 我们可以怎么用
|
|
47
|
+
|
|
48
|
+
你可以按组织现状选择入口,能力层一致。
|
|
37
49
|
|
|
38
|
-
###
|
|
50
|
+
### 路径 A(推荐): OpenClaw / Hermes Agent + IM
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
|------|------|
|
|
42
|
-
| **Node.js** | ≥ 18.0(运行 `node -v` 检查) |
|
|
43
|
-
| **路客云账号** | 已开通路客云 SPMS |
|
|
44
|
-
| **访问凭证** | 已获取 **APP_SECRET** 与 **APP_ID**(由路客云管理员配置) |
|
|
45
|
-
| **AI 客户端** | 已安装 Cursor、Claude Desktop 或 Claude Code |
|
|
52
|
+
在 OpenClaw 或 Hermes Agent 中接入 LocalsBnb MCP 后,可打通:
|
|
46
53
|
|
|
47
|
-
|
|
54
|
+
- 微信
|
|
55
|
+
- 企业微信
|
|
56
|
+
- QQ
|
|
57
|
+
- 飞书
|
|
58
|
+
- 钉钉
|
|
59
|
+
- iMessage
|
|
48
60
|
|
|
49
|
-
|
|
50
|
-
|------|------|----------|
|
|
51
|
-
| **APP_SECRET** | 路客云访问令牌,用于 API 鉴权 | 由路客云后台提供的 token 字符串 |
|
|
52
|
-
| **APP_ID** | 营地/物业 ID,标识一家店或经营主体 | 数字字符串,如 `12345` |
|
|
61
|
+
典型对话:
|
|
53
62
|
|
|
54
|
-
|
|
63
|
+
- 「查询今天房态」
|
|
64
|
+
- 「查询近期房价」
|
|
65
|
+
- 「今天预离还有几单?」
|
|
66
|
+
- 「查看张三的订单详情」
|
|
67
|
+
- 「看下本周入住率和营收」
|
|
68
|
+
- 「帮我根据当前经营情况,并结合近期天气、节假日等情况给出调价建议」
|
|
69
|
+
- 「拉取近 30 天入住率、房价、渠道占比和订单取消率,结合周末与节假日,给我一版下周调价策略(含涨降幅区间和执行优先级)」
|
|
70
|
+
- 「基于今日预抵/预离/在住结构,识别今晚可能的满房风险与空置风险,并给出房态和价格联动建议」
|
|
71
|
+
- 「结合最近一周经营数据与历史同周表现,输出门店晨会简报:异常指标、可能原因、今日行动项」
|
|
72
|
+
- 「对比近 14 天不同渠道订单质量(ADR、间夜、取消率),给出渠道投放与限房建议」
|
|
55
73
|
|
|
56
|
-
|
|
74
|
+
### 路径 B:MCP 客户端直连
|
|
57
75
|
|
|
58
|
-
|
|
76
|
+
适合总部运营、区域管理、店长、实施团队进行日常查询与管理:
|
|
59
77
|
|
|
60
|
-
|
|
78
|
+
- OpenClaw
|
|
79
|
+
- Hermes Agent
|
|
80
|
+
- Cursor
|
|
81
|
+
- Claude Desktop
|
|
82
|
+
- Claude Code
|
|
83
|
+
- 其他 MCP 客户端
|
|
61
84
|
|
|
62
|
-
|
|
85
|
+
---
|
|
63
86
|
|
|
64
|
-
|
|
87
|
+
## 怎么配置
|
|
65
88
|
|
|
66
|
-
###
|
|
89
|
+
### 1) 前置条件
|
|
67
90
|
|
|
68
|
-
|
|
91
|
+
- 已开通路客云相关 API 权限
|
|
92
|
+
- 获取必填凭证:
|
|
93
|
+
- `APP_SECRET`(访问令牌)
|
|
94
|
+
- `APP_ID`(访问ID)
|
|
69
95
|
|
|
70
|
-
|
|
71
|
-
2. 添加配置(**替换凭证为你的实际值**):
|
|
96
|
+
### 2) 通用 MCP 配置
|
|
72
97
|
|
|
73
|
-
**npx 方式(推荐)**
|
|
74
98
|
```json
|
|
75
99
|
{
|
|
76
100
|
"mcpServers": {
|
|
@@ -78,147 +102,102 @@ AI 会帮您调用路客云,并返回结果。
|
|
|
78
102
|
"command": "npx",
|
|
79
103
|
"args": ["--yes", "localsbnb-mcp-server"],
|
|
80
104
|
"env": {
|
|
81
|
-
"APP_SECRET": "<你的
|
|
82
|
-
"APP_ID": "<你的
|
|
105
|
+
"APP_SECRET": "<你的 APP_SECRET>",
|
|
106
|
+
"APP_ID": "<你的 APP_ID>"
|
|
83
107
|
}
|
|
84
108
|
}
|
|
85
109
|
}
|
|
86
110
|
}
|
|
87
111
|
```
|
|
88
112
|
|
|
89
|
-
|
|
90
|
-
```json
|
|
91
|
-
{
|
|
92
|
-
"mcpServers": {
|
|
93
|
-
"LocalsBnb MCP": {
|
|
94
|
-
"command": "sh",
|
|
95
|
-
"args": ["/你的实际路径/dist/run.sh"],
|
|
96
|
-
"env": {
|
|
97
|
-
"APP_SECRET": "<你的 token>",
|
|
98
|
-
"APP_ID": "<你的 campId>"
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
```
|
|
113
|
+
### 3) OpenClaw / Hermes Agent(优先推荐)
|
|
104
114
|
|
|
105
|
-
|
|
115
|
+
这是当前最主流、最容易规模化落地的接入方式,建议作为第一实施路径。
|
|
106
116
|
|
|
107
|
-
|
|
117
|
+
1. 在 OpenClaw / Hermes Agent 中注册 LocalsBnb MCP(配置 `APP_SECRET` + `APP_ID`)
|
|
118
|
+
2. 绑定 IM 渠道(微信、企微、QQ、飞书、钉钉、iMessage)
|
|
119
|
+
3. 配置角色权限与可执行边界(谁可查、谁可操作、谁需二次确认)
|
|
120
|
+
4. 配置常用意图路由(如:今日房态、今日订单、订单详情、经营数据)
|
|
121
|
+
5. 以“查询今天房态 / 查询今日订单 / 输出晨会简报”完成联调验收
|
|
108
122
|
|
|
109
|
-
|
|
123
|
+
> 建议先上线查询类能力,再逐步开放写操作,保证上线稳定性与组织接受度。
|
|
110
124
|
|
|
111
|
-
|
|
112
|
-
- macOS:`~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
113
|
-
- Windows:`%APPDATA%\Claude\claude_desktop_config.json`
|
|
114
|
-
- Linux:`~/.config/Claude/claude_desktop_config.json`
|
|
115
|
-
2. 添加与上文相同的 `mcpServers` 配置块
|
|
116
|
-
3. 保存并重启 Claude Desktop
|
|
125
|
+
#### OpenClaw 自然语言一键安装(推荐新手)
|
|
117
126
|
|
|
118
|
-
|
|
127
|
+
如果你已将 MCP 发布到 GitHub 与 npm,可直接通过对话让 OpenClaw 完成安装与配置。
|
|
119
128
|
|
|
120
|
-
|
|
129
|
+
**步骤 1:准备凭证**
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
- 在路客云 SPMS 获取 `APP_SECRET` 与 `APP_ID`
|
|
132
|
+
- 确认当前账号已开通对应查询权限(订单、房态、房价、经营数据)
|
|
123
133
|
|
|
124
|
-
|
|
134
|
+
**步骤 2:在 OpenClaw 或 Hermes Agent 中发送安装指令**
|
|
125
135
|
|
|
126
|
-
|
|
127
|
-
claude mcp add LocalsBnbMCP --scope user \
|
|
128
|
-
-e APP_SECRET="<你的 token>" \
|
|
129
|
-
-e APP_ID="<你的 campId>" \
|
|
130
|
-
-- npx -y localsbnb-mcp-server
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
- 使用 `-e KEY=value` 传递环境变量(勿用 `--env`)
|
|
134
|
-
- `--scope user`:所有项目可用;改为 `--scope local` 仅当前项目
|
|
135
|
-
|
|
136
|
-
**方式 2:手动编辑配置文件**
|
|
136
|
+
建议使用下面这句(比口语更稳定):
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
"command": "npx",
|
|
145
|
-
"args": ["-y", "localsbnb-mcp-server"],
|
|
146
|
-
"env": {
|
|
147
|
-
"APP_SECRET": "<你的 token>",
|
|
148
|
-
"APP_ID": "<你的 campId>"
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
138
|
+
```text
|
|
139
|
+
请帮我安装 localsbnb-mcp-server,并配置 MCP 服务名为 LocalsBnb MCP。
|
|
140
|
+
使用环境变量:
|
|
141
|
+
APP_SECRET=<你的APP_SECRET>
|
|
142
|
+
APP_ID=<你的APP_ID>
|
|
143
|
+
安装完成后请先执行“查询今天房态”和“查询今日订单”做连通性验证。
|
|
153
144
|
```
|
|
154
145
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
**验证**:在 Claude Code 中输入 `/mcp` 查看是否已加载,或直接说「查询今天的房态」测试。
|
|
146
|
+
**步骤 3:验收**
|
|
158
147
|
|
|
159
|
-
|
|
148
|
+
- 能成功返回“今日房态”
|
|
149
|
+
- 能成功返回“今日订单(预抵/在住/预离)”
|
|
150
|
+
- 若失败,按错误提示检查 `APP_SECRET` / `APP_ID` 是否正确
|
|
160
151
|
|
|
161
|
-
|
|
162
|
-
- **Claude Desktop**:新开对话,输入 `@LocalsBnb MCP` 或「查询今天的房态」
|
|
163
|
-
- **Claude Code**:输入 `/mcp` 查看工具,或直接说「查询今天的房态」
|
|
152
|
+
> 安全建议:请在私聊或受控环境中发送凭证,不要在公开群聊明文发送。
|
|
164
153
|
|
|
165
|
-
|
|
154
|
+
### 4) 其他 MCP 客户端(补充接入)
|
|
166
155
|
|
|
167
|
-
|
|
156
|
+
#### Cursor
|
|
168
157
|
|
|
169
|
-
|
|
170
|
-
|--------|------|----------|
|
|
171
|
-
| `query_today_orders` | 今日订单(预抵/在住/预离) | 「今天有哪些订单?」 |
|
|
172
|
-
| `get_order_details_v2` | 订单详情 | 「查一下订单 12345 的详情」 |
|
|
173
|
-
| `query_today_room_status` | 今日房态 | 「今天房态怎么样?」 |
|
|
174
|
-
| `query_room_status_new` | 房型日历价(新接口) | 「查一下未来 7 天的房态和价格」 |
|
|
175
|
-
| `query_room_prices` | 近期房价 | 「本周房价是多少?」 |
|
|
176
|
-
| `query_operational_data_v2` | 运营数据 | 「今天的经营情况如何?」 |
|
|
158
|
+
编辑 `~/.cursor/mcp.json`,加入上面的 `mcpServers` 配置并重启 Cursor。
|
|
177
159
|
|
|
178
|
-
|
|
160
|
+
#### Claude Desktop
|
|
179
161
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
| `APP_ID` | 是 | 营地 ID |
|
|
184
|
-
| `LOG_LEVEL` | 否 | `info` / `debug`,调试用 |
|
|
162
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
163
|
+
- Windows: `%APPDATA%\\Claude\\claude_desktop_config.json`
|
|
164
|
+
- Linux: `~/.config/Claude/claude_desktop_config.json`
|
|
185
165
|
|
|
186
|
-
|
|
166
|
+
#### Claude Code
|
|
187
167
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
168
|
+
```bash
|
|
169
|
+
claude mcp add LocalsBnbMCP --scope user \
|
|
170
|
+
-e APP_SECRET="<你的 token>" \
|
|
171
|
+
-e APP_ID="<你的 campId>" \
|
|
172
|
+
-- npx -y localsbnb-mcp-server
|
|
173
|
+
```
|
|
194
174
|
|
|
195
175
|
---
|
|
196
176
|
|
|
197
|
-
##
|
|
177
|
+
## 常见问题
|
|
198
178
|
|
|
199
|
-
|
|
|
200
|
-
|
|
201
|
-
|
|
|
202
|
-
|
|
|
203
|
-
|
|
|
204
|
-
|
|
|
179
|
+
| 问题 | 处理方式 |
|
|
180
|
+
|---|---|
|
|
181
|
+
| 连接失败 / 无权限 | 核对 `APP_SECRET`、`APP_ID`,并确认路客云侧已开通权限 |
|
|
182
|
+
| 秘钥错误 | 当前秘钥信息错误,请前往登录路客云 SPMS 获取秘钥,或联系路客云客户经理咨询 |
|
|
183
|
+
| 找不到 MCP 工具 | 检查 JSON 格式、命令路径并重启客户端 |
|
|
184
|
+
| `ERR_REQUIRE_ESM` | 优先使用 `dist/run.sh` 或 `dist/run.cjs` |
|
|
205
185
|
|
|
206
|
-
|
|
186
|
+
---
|
|
207
187
|
|
|
208
|
-
|
|
209
|
-
- **本地部署**:如需在企业内网使用,可联系技术支持获取本地部署方案
|
|
188
|
+
## 安全建议
|
|
210
189
|
|
|
211
|
-
|
|
190
|
+
- 凭证通过环境变量注入
|
|
191
|
+
- 不提交真实 `APP_SECRET` 到仓库
|
|
192
|
+
- 关键操作建议保留审核/确认流程
|
|
212
193
|
|
|
213
|
-
|
|
214
|
-
- 密钥加密存储
|
|
215
|
-
- 支持按接口进行权限控制
|
|
194
|
+
---
|
|
216
195
|
|
|
217
|
-
##
|
|
196
|
+
## 技术支持
|
|
218
197
|
|
|
219
|
-
-
|
|
198
|
+
- 技术支持: [https://minsubao.localhome.cn/](https://minsubao.localhome.cn/)
|
|
220
199
|
|
|
221
200
|
---
|
|
222
201
|
|
|
223
|
-
|
|
224
|
-
|
|
202
|
+
**文档版本**: v2.0
|
|
203
|
+
**最后更新**: 2026-04
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x5d57(_0x14c500,_0x5e5051){const _0x3d9f8a=_0x3d9f();return _0x5d57=function(_0x5d5797,_0x2860ef){_0x5d5797=_0x5d5797-0xb6;let _0x5296e4=_0x3d9f8a[_0x5d5797];return _0x5296e4;},_0x5d57(_0x14c500,_0x5e5051);}function _0x3d9f(){const _0x150c5c=['info','218521RmThTv','APP_SECRET','setAPIKey','1256Rvibcs','scopes','3138fwGHEE','campId','Hudson\x20credentials\x20loaded\x20from\x20config','getScopes','APP_ID\x20not\x20configured.\x20Please\x20set\x20APP_ID\x20environment\x20variable.','383170eMYUGb','env','APP_SECRET\x20not\x20configured.\x20Please\x20set\x20APP_SECRET\x20environment\x20variable.','includes','API\x20key\x20loaded\x20from\x20config','hasScope','length','Hudson\x20credentials\x20loaded\x20from\x20environment','hudsonAccessToken','227030Onvewg','setHudsonCredentials','getAPIKey','Hudson\x20credentials\x20set','loadFromEnv','split','getCampId','trim','apiKey','APP_SECRET\x20or\x20APP_ID\x20not\x20found\x20in\x20environment\x20variables','API\x20key\x20not\x20found\x20in\x20environment\x20variables','300kGwqwt','hasAPIKey','warn','isHudsonConfigured','APP_ID','API\x20key\x20loaded\x20from\x20environment','3115315hKlHiT','2339094BLIEQI','16623XmKOvC','isConfigured'];_0x3d9f=function(){return _0x150c5c;};return _0x3d9f();}(function(_0x1552c0,_0x1e47f6){const _0x1a210b=_0x1552c0();while(!![]){try{const _0x1b00dc=-parseInt(_0x5d57(0xb6))/0x1+parseInt(_0x5d57(0xc9))/0x2+parseInt(_0x5d57(0xbb))/0x3*(parseInt(_0x5d57(0xd4))/0x4)+-parseInt(_0x5d57(0xc0))/0x5+-parseInt(_0x5d57(0xdb))/0x6+parseInt(_0x5d57(0xda))/0x7+-parseInt(_0x5d57(0xb9))/0x8*(-parseInt(_0x5d57(0xdc))/0x9);if(_0x1b00dc===_0x1e47f6)break;else _0x1a210b['push'](_0x1a210b['shift']());}catch(_0x13d87c){_0x1a210b['push'](_0x1a210b['shift']());}}}(_0x3d9f,0x3b141));import{logger}from'../utils/logger.js';export class APIKeyManager{[_0x5d57(0xd1)]=null;[_0x5d57(0xba)]=[];[_0x5d57(0xc8)]=null;[_0x5d57(0xbc)]=null;[_0x5d57(0xcd)](){this[_0x5d57(0xd1)]=process[_0x5d57(0xc1)]['LUKEYUN_API_KEY']||null;const _0x5c9a7c=process[_0x5d57(0xc1)]['LUKEYUN_API_SCOPES'];this[_0x5d57(0xba)]=_0x5c9a7c?_0x5c9a7c[_0x5d57(0xce)](',')['map'](_0x58556e=>_0x58556e[_0x5d57(0xd0)]()):[],this[_0x5d57(0xc8)]=process[_0x5d57(0xc1)][_0x5d57(0xb7)]||null,this['campId']=process[_0x5d57(0xc1)][_0x5d57(0xd8)]||null,!this[_0x5d57(0xd1)]?logger[_0x5d57(0xd6)](_0x5d57(0xd3)):logger[_0x5d57(0xde)](_0x5d57(0xd9),{'hasScopes':this[_0x5d57(0xba)][_0x5d57(0xc6)]>0x0}),!this[_0x5d57(0xc8)]||!this[_0x5d57(0xbc)]?logger[_0x5d57(0xd6)](_0x5d57(0xd2)):logger[_0x5d57(0xde)](_0x5d57(0xc7));}['loadFromConfig'](_0x598672){this[_0x5d57(0xd1)]=_0x598672[_0x5d57(0xd1)]||null,this['scopes']=_0x598672['scopes']||[],this[_0x5d57(0xc8)]=_0x598672['hudsonAccessToken']||null,this[_0x5d57(0xbc)]=_0x598672['campId']||null,this[_0x5d57(0xd1)]&&logger['info'](_0x5d57(0xc4),{'hasScopes':this['scopes'][_0x5d57(0xc6)]>0x0}),this['hudsonAccessToken']&&this[_0x5d57(0xbc)]&&logger[_0x5d57(0xde)](_0x5d57(0xbd));}[_0x5d57(0xb8)](_0x416b23,_0x15df9a){this[_0x5d57(0xd1)]=_0x416b23,this[_0x5d57(0xba)]=_0x15df9a||[],logger['info']('API\x20key\x20set',{'hasScopes':this[_0x5d57(0xba)][_0x5d57(0xc6)]>0x0});}[_0x5d57(0xca)](_0x1abe27,_0xa375db){this[_0x5d57(0xc8)]=_0x1abe27,this[_0x5d57(0xbc)]=_0xa375db,logger[_0x5d57(0xde)](_0x5d57(0xcc));}[_0x5d57(0xcb)](){return this[_0x5d57(0xd1)]||'';}[_0x5d57(0xd5)](){return this[_0x5d57(0xd1)]!==null&&this[_0x5d57(0xd1)]!=='';}[_0x5d57(0xc5)](_0x7c001c){if(this[_0x5d57(0xba)][_0x5d57(0xc3)]('*'))return!![];return this[_0x5d57(0xba)]['includes'](_0x7c001c);}[_0x5d57(0xbe)](){return[...this[_0x5d57(0xba)]];}[_0x5d57(0xdd)](){return this[_0x5d57(0xd1)]!==null;}[_0x5d57(0xd7)](){return this[_0x5d57(0xc8)]!==null&&this[_0x5d57(0xbc)]!==null;}['getHudsonAccessToken'](){if(!this[_0x5d57(0xc8)])throw new Error(_0x5d57(0xc2));return this[_0x5d57(0xc8)];}[_0x5d57(0xcf)](){if(!this[_0x5d57(0xbc)])throw new Error(_0x5d57(0xbf));return this[_0x5d57(0xbc)];}}
|
package/dist/auth/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x4a1b(){var _0x2794c1=['4LxKRuE','1811000YRxtMn','10UyHvcj','11928862sjZSOA','8251428nweAAS','9990uNXTkP','4794EkitPP','194299rddpOw','2573406sJzYTA','35YtjDRd','212fAMgkt','7377vTKdqX'];_0x4a1b=function(){return _0x2794c1;};return _0x4a1b();}(function(_0x398a58,_0x468ca9){var _0x8f7510=_0x398a58();while(!![]){try{var _0xa65dad=parseInt(_0x1da2(0x128))/0x1*(parseInt(_0x1da2(0x121))/0x2)+parseInt(_0x1da2(0x120))/0x3*(-parseInt(_0x1da2(0x11f))/0x4)+parseInt(_0x1da2(0x126))/0x5*(parseInt(_0x1da2(0x127))/0x6)+-parseInt(_0x1da2(0x11e))/0x7*(parseInt(_0x1da2(0x122))/0x8)+-parseInt(_0x1da2(0x11d))/0x9*(parseInt(_0x1da2(0x123))/0xa)+parseInt(_0x1da2(0x124))/0xb+-parseInt(_0x1da2(0x125))/0xc;if(_0xa65dad===_0x468ca9)break;else _0x8f7510['push'](_0x8f7510['shift']());}catch(_0x209e95){_0x8f7510['push'](_0x8f7510['shift']());}}}(_0x4a1b,0xcb897));export{APIKeyManager}from'./apiKeyManager.js';function _0x1da2(_0x43090a,_0x202fdc){var _0x4a1b04=_0x4a1b();return _0x1da2=function(_0x1da2d2,_0xa69c66){_0x1da2d2=_0x1da2d2-0x11d;var _0x51b2fe=_0x4a1b04[_0x1da2d2];return _0x51b2fe;},_0x1da2(_0x43090a,_0x202fdc);}export{PermissionChecker}from'./permissionChecker.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x400610,_0x2a043c){const _0x1c8fd0=_0x400610();while(!![]){try{const _0x5414d9=-parseInt(_0x5569(0x1c1))/0x1+-parseInt(_0x5569(0x1d3))/0x2+-parseInt(_0x5569(0x1d6))/0x3+parseInt(_0x5569(0x1ca))/0x4*(-parseInt(_0x5569(0x1d8))/0x5)+parseInt(_0x5569(0x1be))/0x6*(parseInt(_0x5569(0x1c4))/0x7)+parseInt(_0x5569(0x1bc))/0x8+parseInt(_0x5569(0x1c8))/0x9;if(_0x5414d9===_0x2a043c)break;else _0x1c8fd0['push'](_0x1c8fd0['shift']());}catch(_0x3dbde0){_0x1c8fd0['push'](_0x1c8fd0['shift']());}}}(_0x5e12,0x31bfc));import{MCPError,ErrorCode,getPermissionDeniedMessage}from'../utils/errorHandler.js';import{logger}from'../utils/logger.js';function toolToPermissionDomain(_0x3f4ac1){switch(_0x3f4ac1){case'query_today_orders':case _0x5569(0x1d7):case'query_in_house_orders':case'query_pre_departure_orders':case _0x5569(0x1d2):case _0x5569(0x1da):case _0x5569(0x1d4):case _0x5569(0x1d0):return _0x5569(0x1c5);case _0x5569(0x1cd):return _0x5569(0x1c0);case _0x5569(0x1d1):case'query_room_status_new':return'room_status';case'query_room_prices':return _0x5569(0x1cf);default:return _0x5569(0x1c7);}}export class PermissionChecker{[_0x5569(0x1bf)];constructor(_0x497b5e){this[_0x5569(0x1bf)]=_0x497b5e;}[_0x5569(0x1cc)](_0x4e6575,_0x1b4d96){if(_0x1b4d96[_0x5569(0x1ce)]===0x0)return;if(!this[_0x5569(0x1bf)][_0x5569(0x1c3)]()&&this[_0x5569(0x1bf)][_0x5569(0x1d5)]()){logger[_0x5569(0x1bd)](_0x5569(0x1c6),{'tool':_0x4e6575,'requiredScopes':_0x1b4d96});return;}const _0x58d30e=_0x1b4d96[_0x5569(0x1c2)](_0xa3f5fa=>this[_0x5569(0x1bf)]['hasScope'](_0xa3f5fa));if(!_0x58d30e){const _0x48d00e=this[_0x5569(0x1bf)][_0x5569(0x1c9)](),_0x38a670=toolToPermissionDomain(_0x4e6575);logger[_0x5569(0x1d9)](_0x5569(0x1cb),{'tool':_0x4e6575,'required':_0x1b4d96,'current':_0x48d00e,'domain':_0x38a670});throw new MCPError(ErrorCode['PERMISSION_DENIED'],getPermissionDeniedMessage(_0x38a670),{'tool':_0x4e6575,'requiredScopes':_0x1b4d96,'currentScopes':_0x48d00e,'domain':_0x38a670,'source':'路客云AI'});}logger['debug']('Permission\x20check\x20passed',{'tool':_0x4e6575,'scopes':_0x1b4d96});}}function _0x5569(_0x378c9f,_0x473d8c){const _0x5e1297=_0x5e12();return _0x5569=function(_0x556923,_0x538fcf){_0x556923=_0x556923-0x1bc;let _0x495643=_0x5e1297[_0x556923];return _0x495643;},_0x5569(_0x378c9f,_0x473d8c);}function _0x5e12(){const _0x4f35e3=['query_orders','isHudsonConfigured','378219oSJTVC','query_pre_arrival_orders','5kWSiFV','warn','get_order_details_v2','2709136MjZAjv','debug','294fhXVcY','keyManager','finance','267860GtgFSf','some','hasAPIKey','29918IuIdYM','orders','Permission\x20check\x20passed\x20(Hudson\x20auth\x20only)','generic','3155310TRklnp','getScopes','1131752qNLmCu','Permission\x20denied','checkPermission','query_operational_data_v2','length','room_price','get_order_details','query_today_room_status','query_orders_by_date_range','36030kyZEDQ'];_0x5e12=function(){return _0x4f35e3;};return _0x5e12();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x3650(){const _0x54849e=['1530982lNXJVS','sort','138gfCrwV','Cache\x20deleted','982666xSlMAj','stringify','3931690YlnIFH','set','Cache\x20cleared','get','delete','2062612HpenFN','join','enabled','map','expiresAt','cache','220565WcbXTR','data','now','generateKey','3785280jJALko','18ndaLIp','clear','905430xgsqEe','debug','Cache\x20hit'];_0x3650=function(){return _0x54849e;};return _0x3650();}(function(_0xdcbeb7,_0x4fb4d5){const _0x223608=_0xdcbeb7();while(!![]){try{const _0x457cc4=parseInt(_0x31a5(0x1db))/0x1+parseInt(_0x31a5(0x1d7))/0x2+-parseInt(_0x31a5(0x1d4))/0x3+parseInt(_0x31a5(0x1e2))/0x4+parseInt(_0x31a5(0x1cd))/0x5*(-parseInt(_0x31a5(0x1d9))/0x6)+parseInt(_0x31a5(0x1dd))/0x7+parseInt(_0x31a5(0x1d1))/0x8*(-parseInt(_0x31a5(0x1d2))/0x9);if(_0x457cc4===_0x4fb4d5)break;else _0x223608['push'](_0x223608['shift']());}catch(_0x11a5b4){_0x223608['push'](_0x223608['shift']());}}}(_0x3650,0x8963f));import{config}from'../config/index.js';function _0x31a5(_0x3fa687,_0x4e1697){const _0x36508e=_0x3650();return _0x31a5=function(_0x31a58b,_0x5d4e57){_0x31a58b=_0x31a58b-0x1cb;let _0x3d0b4e=_0x36508e[_0x31a58b];return _0x3d0b4e;},_0x31a5(_0x3fa687,_0x4e1697);}import{logger}from'../utils/logger.js';export class CacheManager{[_0x31a5(0x1cc)]=new Map();[_0x31a5(0x1e0)](_0x328869){if(!config[_0x31a5(0x1cc)][_0x31a5(0x1e4)])return null;const _0x3caffd=this[_0x31a5(0x1cc)][_0x31a5(0x1e0)](_0x328869);if(!_0x3caffd)return null;if(Date[_0x31a5(0x1cf)]()>_0x3caffd[_0x31a5(0x1cb)])return this[_0x31a5(0x1cc)][_0x31a5(0x1e1)](_0x328869),logger[_0x31a5(0x1d5)]('Cache\x20expired',{'key':_0x328869}),null;return logger['debug'](_0x31a5(0x1d6),{'key':_0x328869}),_0x3caffd[_0x31a5(0x1ce)];}[_0x31a5(0x1de)](_0x4c6d17,_0xe24246,_0x288f7f){if(!config[_0x31a5(0x1cc)][_0x31a5(0x1e4)])return;const _0x29c5d6=_0x288f7f||config['cache']['ttl'];this[_0x31a5(0x1cc)][_0x31a5(0x1de)](_0x4c6d17,{'data':_0xe24246,'expiresAt':Date[_0x31a5(0x1cf)]()+_0x29c5d6}),logger['debug']('Cache\x20set',{'key':_0x4c6d17,'ttl':_0x29c5d6});}[_0x31a5(0x1e1)](_0x2c6e94){this['cache'][_0x31a5(0x1e1)](_0x2c6e94),logger[_0x31a5(0x1d5)](_0x31a5(0x1da),{'key':_0x2c6e94});}[_0x31a5(0x1d3)](){this[_0x31a5(0x1cc)][_0x31a5(0x1d3)](),logger[_0x31a5(0x1d5)](_0x31a5(0x1df));}static[_0x31a5(0x1d0)](_0x44864d,_0x28be54){const _0xec813=Object['keys'](_0x28be54)[_0x31a5(0x1d8)]()[_0x31a5(0x1e5)](_0x34acbf=>_0x34acbf+'='+JSON[_0x31a5(0x1dc)](_0x28be54[_0x34acbf]))[_0x31a5(0x1e3)]('&');return _0x44864d+':'+_0xec813;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3c2552,_0x16f62b){const _0x30f81e=_0x3c2552();while(!![]){try{const _0x5c91ca=parseInt(_0x54aa(0x1f9))/0x1+-parseInt(_0x54aa(0x200))/0x2*(-parseInt(_0x54aa(0x216))/0x3)+-parseInt(_0x54aa(0x205))/0x4+-parseInt(_0x54aa(0x20c))/0x5+-parseInt(_0x54aa(0x210))/0x6+parseInt(_0x54aa(0x214))/0x7*(parseInt(_0x54aa(0x20b))/0x8)+parseInt(_0x54aa(0x201))/0x9;if(_0x5c91ca===_0x16f62b)break;else _0x30f81e['push'](_0x30f81e['shift']());}catch(_0x5058d3){_0x30f81e['push'](_0x30f81e['shift']());}}}(_0x3b93,0x340f2));import _0xddb8b9 from'axios';import{config}from'../config/index.js';import{logger}from'../utils/logger.js';import{MCPError,ErrorCode}from'../utils/errorHandler.js';import{RetryHandler}from'./retryHandler.js';export class HTTPClient{[_0x54aa(0x218)];[_0x54aa(0x1fc)];['hudsonAccessToken'];[_0x54aa(0x1e8)];constructor(_0xd93785,_0x2656be){this[_0x54aa(0x1fc)]=_0xd93785,this[_0x54aa(0x1ea)]=_0x2656be,this[_0x54aa(0x1e8)]=new RetryHandler(config[_0x54aa(0x21e)]['maxRetries'],config[_0x54aa(0x21e)][_0x54aa(0x1f7)]),this[_0x54aa(0x218)]=_0xddb8b9[_0x54aa(0x211)]({'baseURL':config[_0x54aa(0x203)]['baseURL'],'timeout':config[_0x54aa(0x203)][_0x54aa(0x21b)],'headers':{'Content-Type':_0x54aa(0x217),'X-Client-Type':_0x54aa(0x1f0),'X-Client-Version':process['env'][_0x54aa(0x213)]||_0x54aa(0x21c)}}),this[_0x54aa(0x221)]();}[_0x54aa(0x221)](){this[_0x54aa(0x218)]['interceptors'][_0x54aa(0x1fa)][_0x54aa(0x1f4)](_0x5b5af6=>{return this[_0x54aa(0x1fc)]&&(_0x5b5af6[_0x54aa(0x1fb)]['Authorization']='Bearer\x20'+this[_0x54aa(0x1fc)]),this[_0x54aa(0x1ea)]&&(_0x5b5af6[_0x54aa(0x1fb)]['hudson-access-token']=this[_0x54aa(0x1ea)]),logger[_0x54aa(0x212)]('API\x20request',{'method':_0x5b5af6[_0x54aa(0x1f2)],'url':_0x5b5af6[_0x54aa(0x20e)],'params':_0x5b5af6['params']}),_0x5b5af6;},_0x2999e5=>{return logger[_0x54aa(0x220)](_0x54aa(0x1e9),_0x2999e5),Promise[_0x54aa(0x206)](_0x2999e5);}),this[_0x54aa(0x218)]['interceptors'][_0x54aa(0x1ef)]['use'](_0x1b36d6=>{return logger[_0x54aa(0x212)](_0x54aa(0x1eb),{'status':_0x1b36d6[_0x54aa(0x219)],'url':_0x1b36d6[_0x54aa(0x1ff)]['url']}),_0x1b36d6;},async _0x4d9f7c=>{return this[_0x54aa(0x224)](_0x4d9f7c);});}async[_0x54aa(0x224)](_0x546492){if(_0x546492[_0x54aa(0x1ef)]){const _0x37dbaf=_0x546492[_0x54aa(0x1ef)][_0x54aa(0x219)],_0x4ea5ab=_0x546492[_0x54aa(0x1ef)][_0x54aa(0x223)];logger['error'](_0x54aa(0x21f),{'status':_0x37dbaf,'url':_0x546492[_0x54aa(0x1ff)]?.['url'],'message':_0x4ea5ab[_0x54aa(0x20f)]});switch(_0x37dbaf){case 0x191:throw new MCPError(ErrorCode[_0x54aa(0x1f3)],_0x54aa(0x202),_0x4ea5ab);case 0x193:throw new MCPError(ErrorCode[_0x54aa(0x1fe)],_0x4ea5ab?.['message']||_0x54aa(0x208),{..._0x4ea5ab!=null&&typeof _0x4ea5ab===_0x54aa(0x204)?_0x4ea5ab:{},'domain':_0x54aa(0x215),'source':_0x54aa(0x207)});case 0x194:throw new MCPError(ErrorCode[_0x54aa(0x209)],'资源不存在',_0x4ea5ab);case 0x1ad:throw new MCPError(ErrorCode[_0x54aa(0x21a)],_0x54aa(0x1ec),_0x4ea5ab);case 0x1f4:case 0x1f6:case 0x1f7:case 0x1f8:throw new MCPError(ErrorCode[_0x54aa(0x21d)],_0x54aa(0x1f5),_0x4ea5ab);default:throw new MCPError(ErrorCode[_0x54aa(0x21d)],_0x4ea5ab[_0x54aa(0x20f)]||_0x54aa(0x20d)+_0x37dbaf,_0x4ea5ab);}}else{if(_0x546492[_0x54aa(0x1fa)]){logger['error'](_0x54aa(0x1f6),{'url':_0x546492[_0x54aa(0x1ff)]?.['url'],'timeout':config[_0x54aa(0x203)]['timeout']});if(_0x546492['code']===_0x54aa(0x1fd))throw new MCPError(ErrorCode[_0x54aa(0x222)],_0x54aa(0x1f1));throw new MCPError(ErrorCode[_0x54aa(0x21d)],_0x54aa(0x1ed));}else{logger[_0x54aa(0x220)](_0x54aa(0x1f8),_0x546492);throw new MCPError(ErrorCode[_0x54aa(0x1ee)],'请求配置错误');}}}async[_0x54aa(0x1fa)](_0x2d158e){const _0x516e10={'method':_0x2d158e[_0x54aa(0x1f2)],'url':_0x2d158e[_0x54aa(0x20e)],'params':_0x2d158e['params'],'data':_0x2d158e[_0x54aa(0x223)],'headers':_0x2d158e[_0x54aa(0x1fb)]};try{const _0x110351=await this[_0x54aa(0x1e8)][_0x54aa(0x20a)](()=>this[_0x54aa(0x218)][_0x54aa(0x1fa)](_0x516e10));return _0x110351[_0x54aa(0x223)];}catch(_0x15a011){throw _0x15a011;}}}function _0x54aa(_0x31d0dd,_0x509151){const _0x3b9303=_0x3b93();return _0x54aa=function(_0x54aa66,_0xf9ec7a){_0x54aa66=_0x54aa66-0x1e8;let _0x15aedb=_0x3b9303[_0x54aa66];return _0x15aedb;},_0x54aa(_0x31d0dd,_0x509151);}function _0x3b93(){const _0x5b5662=['1529290gCRsZK','API错误:','url','message','2285544FJnxZc','create','debug','npm_package_version','2317EUrwkZ','generic','331179hgddQU','application/json','client','status','API_RATE_LIMIT','timeout','1.0.0','API_ERROR','retry','API\x20error\x20response','error','setupInterceptors','API_TIMEOUT','data','handleError','retryHandler','Request\x20interceptor\x20error','hudsonAccessToken','API\x20response','请求频率过高,请稍后重试','网络错误,请检查网络连接','INTERNAL_ERROR','response','mcp','请求超时,请稍后重试','method','AUTH_INVALID','use','服务器错误,请稍后重试','API\x20request\x20timeout','delay','Request\x20configuration\x20error','369165QCQeXr','request','headers','apiKey','ECONNABORTED','PERMISSION_DENIED','config','2BzKNGy','3990276zqWhfn','API密钥无效或已过期','api','object','708608efKUgi','reject','路客云AI','权限不足','API_NOT_FOUND','execute','3728aefJEG'];_0x3b93=function(){return _0x5b5662;};return _0x3b93();}
|
package/dist/client/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x5471(){var _0x16ee36=['7qoXsPS','742312yYILVJ','1176944dXQCKt','4787037sEXwTc','110ldbLeG','112936xtbnix','4900698gSbsWu','2828724RHtFJL','984735BdVaHe','20nOksvf','30nfQzbc','39aFYKRY'];_0x5471=function(){return _0x16ee36;};return _0x5471();}(function(_0x4e0e34,_0xb40153){var _0x719a=_0x4e0e34();while(!![]){try{var _0x431500=parseInt(_0x4242(0x1e8))/0x1+parseInt(_0x4242(0x1e5))/0x2*(parseInt(_0x4242(0x1eb))/0x3)+parseInt(_0x4242(0x1ed))/0x4*(parseInt(_0x4242(0x1ea))/0x5)+-parseInt(_0x4242(0x1e6))/0x6+-parseInt(_0x4242(0x1ec))/0x7*(parseInt(_0x4242(0x1ee))/0x8)+-parseInt(_0x4242(0x1ef))/0x9*(-parseInt(_0x4242(0x1e9))/0xa)+-parseInt(_0x4242(0x1f0))/0xb*(parseInt(_0x4242(0x1e7))/0xc);if(_0x431500===_0xb40153)break;else _0x719a['push'](_0x719a['shift']());}catch(_0x35e2df){_0x719a['push'](_0x719a['shift']());}}}(_0x5471,0x8c5b6));function _0x4242(_0x30308f,_0x20196f){var _0x54714e=_0x5471();return _0x4242=function(_0x424280,_0x2d7558){_0x424280=_0x424280-0x1e5;var _0xc9586d=_0x54714e[_0x424280];return _0xc9586d;},_0x4242(_0x30308f,_0x20196f);}export{HTTPClient}from'./httpClient.js';export{RetryHandler}from'./retryHandler.js';export{CacheManager}from'./cacheManager.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x123b(_0x4c18bb,_0x548d4d){const _0xcd0ed4=_0xcd0e();return _0x123b=function(_0x123b76,_0x1995bc){_0x123b76=_0x123b76-0xaa;let _0x513d5e=_0xcd0ed4[_0x123b76];return _0x513d5e;},_0x123b(_0x4c18bb,_0x548d4d);}(function(_0x3edca9,_0x5a6e9c){const _0x4d186f=_0x3edca9();while(!![]){try{const _0xb78182=-parseInt(_0x123b(0xab))/0x1+-parseInt(_0x123b(0xbb))/0x2*(-parseInt(_0x123b(0xb3))/0x3)+parseInt(_0x123b(0xae))/0x4+parseInt(_0x123b(0xbc))/0x5+-parseInt(_0x123b(0xaa))/0x6+-parseInt(_0x123b(0xad))/0x7+-parseInt(_0x123b(0xb9))/0x8;if(_0xb78182===_0x5a6e9c)break;else _0x4d186f['push'](_0x4d186f['shift']());}catch(_0x4802b3){_0x4d186f['push'](_0x4d186f['shift']());}}}(_0xcd0e,0x2ba1a));import{logger}from'../utils/logger.js';import{AxiosError}from'axios';export class RetryHandler{[_0x123b(0xb5)];[_0x123b(0xb7)];constructor(_0x6611c8=0x3,_0x4d1d07=0x3e8){this[_0x123b(0xb5)]=_0x6611c8,this[_0x123b(0xb7)]=_0x4d1d07;}async['execute'](_0x5257c7){let _0x13238a;for(let _0x5350dc=0x0;_0x5350dc<=this[_0x123b(0xb5)];_0x5350dc++){try{return await _0x5257c7();}catch(_0xb3ad88){_0x13238a=_0xb3ad88;if(_0x5350dc===this['maxRetries'])break;if(!this['isRetryableError'](_0xb3ad88))throw _0xb3ad88;const _0xe6961a=this['baseDelay']*Math['pow'](0x2,_0x5350dc);logger[_0x123b(0xb6)](_0x123b(0xb8)+(_0x5350dc+0x1)+'/'+this[_0x123b(0xb5)]+')',{'error':_0xb3ad88 instanceof Error?_0xb3ad88['message']:String(_0xb3ad88),'delay':_0xe6961a}),await this[_0x123b(0xb2)](_0xe6961a);}}throw _0x13238a;}[_0x123b(0xb4)](_0xcdc9e7){if(_0xcdc9e7 instanceof AxiosError){if(_0xcdc9e7[_0x123b(0xbd)]===_0x123b(0xb0)||_0xcdc9e7[_0x123b(0xbd)]===_0x123b(0xb1)||_0xcdc9e7[_0x123b(0xbd)]===_0x123b(0xba))return!![];if(_0xcdc9e7[_0x123b(0xac)]&&_0xcdc9e7[_0x123b(0xac)][_0x123b(0xaf)]>=0x1f4)return!![];if(_0xcdc9e7[_0x123b(0xac)]&&_0xcdc9e7[_0x123b(0xac)][_0x123b(0xaf)]===0x1ad)return!![];}return![];}[_0x123b(0xb2)](_0x1c757c){return new Promise(_0x1150f8=>setTimeout(_0x1150f8,_0x1c757c));}}function _0xcd0e(){const _0x2dde1a=['response','80591QiRuuZ','1400452COtOgd','status','ECONNRESET','ETIMEDOUT','sleep','123iHYNyU','isRetryableError','maxRetries','warn','baseDelay','Request\x20failed,\x20retrying...\x20(attempt\x20','3587048QuucPs','ECONNABORTED','14990bDxJBa','1197020okvFVR','code','1285302qKwYwW','43987NlpdWl'];_0xcd0e=function(){return _0x2dde1a;};return _0xcd0e();}
|
package/dist/config/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x50bcb8,_0x5e00f9){const _0x49415a=_0x50bcb8();while(!![]){try{const _0x3e02f5=parseInt(_0x3762(0x199))/0x1*(parseInt(_0x3762(0x1a4))/0x2)+-parseInt(_0x3762(0x1ab))/0x3*(parseInt(_0x3762(0x198))/0x4)+-parseInt(_0x3762(0x197))/0x5+parseInt(_0x3762(0x1ad))/0x6+-parseInt(_0x3762(0x1b0))/0x7*(parseInt(_0x3762(0x195))/0x8)+-parseInt(_0x3762(0x1a7))/0x9+-parseInt(_0x3762(0x19b))/0xa*(-parseInt(_0x3762(0x1a2))/0xb);if(_0x3e02f5===_0x5e00f9)break;else _0x49415a['push'](_0x49415a['shift']());}catch(_0x3bf29f){_0x49415a['push'](_0x49415a['shift']());}}}(_0x336f,0xbb041));import _0x474cc9 from'dotenv';function _0x3762(_0x44f120,_0x53d3e4){const _0x336f29=_0x336f();return _0x3762=function(_0x3762c9,_0x254f1c){_0x3762c9=_0x3762c9-0x194;let _0x31a178=_0x336f29[_0x3762c9];return _0x31a178;},_0x3762(_0x44f120,_0x53d3e4);}_0x474cc9['config']();const resolvedEnv=process[_0x3762(0x1a5)][_0x3762(0x1ac)]||_0x3762(0x19a);function _0x336f(){const _0x5d87b5=['info','24591ghyujp','develop','LUKEYUN_API_BASE_URL','1944pNAPQH','LOG_FORMAT','4345770lHfDEJ','2074984CbgvSb','11AMlWUX','production','170noQKzl','300000','json','LOCALSBNB_LOG_TO_FILES','30000','https://hudson-dev.localhome.cn','3000','1210517ILFfdY','https://hudson-prod.localhome.cn','277154AnDHdL','env','PORT','4476564rlEqXJ','CACHE_ENABLED','LOG_LEVEL','true','6rEbfMW','NODE_ENV','3771432vQXaOH','CACHE_TTL'];_0x336f=function(){return _0x5d87b5;};return _0x336f();}function resolveBaseURL(){if(process['env'][_0x3762(0x194)])return process[_0x3762(0x1a5)][_0x3762(0x194)];if(resolvedEnv===_0x3762(0x1b1)||resolvedEnv==='development')return _0x3762(0x1a0);return _0x3762(0x1a3);}export const config={'api':{'baseURL':resolveBaseURL(),'timeout':parseInt(process[_0x3762(0x1a5)]['API_TIMEOUT']||_0x3762(0x19f),0xa)},'server':{'port':parseInt(process['env'][_0x3762(0x1a6)]||_0x3762(0x1a1),0xa),'env':resolvedEnv},'cache':{'enabled':process[_0x3762(0x1a5)][_0x3762(0x1a8)]===_0x3762(0x1aa),'ttl':parseInt(process[_0x3762(0x1a5)][_0x3762(0x1ae)]||_0x3762(0x19c),0xa)},'retry':{'maxRetries':parseInt(process[_0x3762(0x1a5)]['MAX_RETRIES']||'3',0xa),'delay':parseInt(process[_0x3762(0x1a5)]['RETRY_DELAY']||'1000',0xa)},'log':{'level':process[_0x3762(0x1a5)][_0x3762(0x1a9)]||_0x3762(0x1af),'format':process[_0x3762(0x1a5)][_0x3762(0x196)]||_0x3762(0x19d),'toFiles':process['env'][_0x3762(0x19e)]==='1'||process[_0x3762(0x1a5)][_0x3762(0x19e)]==='true'}};
|