@bty/customer-service-cli 0.6.10 → 0.6.11
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/CHANGELOG.md +4 -0
- package/dist/bin.js +32 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.11 (2026-08-27)
|
|
4
|
+
|
|
5
|
+
- `workspace points-consumes` 改用 `customer-observability-api` 备库 Cursor 接口,支持 `--cursor`、`--start`、`--end`、`--limit`,可继续读取超过 10000 条的历史积分流水。
|
|
6
|
+
|
|
3
7
|
## 0.6.10 (2026-08-26)
|
|
4
8
|
|
|
5
9
|
- `context-search`:`query_content` 增加最少 2 个字符的本地校验,避免过短关键词触发服务端全量扫描。
|
package/dist/bin.js
CHANGED
|
@@ -1258,16 +1258,31 @@ async function getDailyDeduction(opts) {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
);
|
|
1260
1260
|
}
|
|
1261
|
+
var MAX_POINTS_CURSOR_PAGES = 500;
|
|
1261
1262
|
async function getPointsConsumes(opts) {
|
|
1262
1263
|
const request = createRequest();
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1264
|
+
const items = [];
|
|
1265
|
+
let cursor = opts.cursor;
|
|
1266
|
+
let fetchedPages = 0;
|
|
1267
|
+
while (fetchedPages < MAX_POINTS_CURSOR_PAGES) {
|
|
1268
|
+
fetchedPages += 1;
|
|
1269
|
+
const page = await request(getObservabilityUrl(), "/v1/points/consumes", {
|
|
1270
|
+
method: "GET",
|
|
1271
|
+
query: {
|
|
1272
|
+
cursor,
|
|
1273
|
+
start_time: opts.startTime,
|
|
1274
|
+
end_time: opts.endTime,
|
|
1275
|
+
limit: opts.limit
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
items.push(...page.items);
|
|
1279
|
+
const nextCursor = page.has_more && page.next_cursor ? page.next_cursor : void 0;
|
|
1280
|
+
if (!nextCursor) {
|
|
1281
|
+
return { ...page, items, next_cursor: null, has_more: false, fetched_pages: fetchedPages };
|
|
1269
1282
|
}
|
|
1270
|
-
|
|
1283
|
+
cursor = nextCursor;
|
|
1284
|
+
}
|
|
1285
|
+
throw new Error(`\u79EF\u5206\u6D41\u6C34\u5206\u9875\u8D85\u8FC7 ${MAX_POINTS_CURSOR_PAGES} \u9875\uFF0C\u8BF7\u7F29\u5C0F\u65F6\u95F4\u8303\u56F4`);
|
|
1271
1286
|
}
|
|
1272
1287
|
|
|
1273
1288
|
// src/commands/config.ts
|
|
@@ -7511,17 +7526,18 @@ function registerWorkspaceCommand(program2) {
|
|
|
7511
7526
|
process.exit(toExitCode(err));
|
|
7512
7527
|
}
|
|
7513
7528
|
});
|
|
7514
|
-
workspace.command("points-consumes").description("\
|
|
7529
|
+
workspace.command("points-consumes").description("\u4F7F\u7528\u6E38\u6807\u67E5\u8BE2\u5F53\u524D\u5DE5\u4F5C\u7A7A\u95F4\u7684\u79EF\u5206\u6D41\u6C34\uFF08\u8BFB\u53D6\u89C2\u6D4B\u670D\u52A1\u5907\u5E93\uFF09").option("--cursor <token>", "\u4E0B\u4E00\u9875\u6E38\u6807").option("--start <ISO>", "\u8D77\u59CB\u65F6\u95F4\uFF08\u542B\uFF09").option("--end <ISO>", "\u7ED3\u675F\u65F6\u95F4\uFF08\u4E0D\u542B\uFF09").option("--limit <number>", "\u6BCF\u6279\u6570\u91CF\uFF0C\u9ED8\u8BA4 100", "100").action(async (opts) => {
|
|
7515
7530
|
try {
|
|
7516
|
-
const
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
throw new Error("--page \u5FC5\u987B\u4E3A\u6B63\u6574\u6570");
|
|
7531
|
+
const limit = Number(opts.limit);
|
|
7532
|
+
if (!Number.isInteger(limit) || limit <= 0 || limit > 500) {
|
|
7533
|
+
throw new Error("--limit \u5FC5\u987B\u4E3A 1-500 \u7684\u6574\u6570");
|
|
7520
7534
|
}
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7535
|
+
const data = await getPointsConsumes({
|
|
7536
|
+
cursor: opts.cursor,
|
|
7537
|
+
startTime: opts.start,
|
|
7538
|
+
endTime: opts.end,
|
|
7539
|
+
limit
|
|
7540
|
+
});
|
|
7525
7541
|
formatOutput({ success: true, data }, program2.opts().table);
|
|
7526
7542
|
} catch (err) {
|
|
7527
7543
|
reportCaughtError(err);
|