@roxybrowser/openapi 1.0.11 → 1.0.12-beta.0
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/lib/cli.cjs +58 -14
- package/lib/cli.cjs.map +1 -1
- package/lib/cli.js +58 -14
- package/lib/cli.js.map +1 -1
- package/lib/index.cjs +58 -14
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +58 -14
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/cli.cjs
CHANGED
|
@@ -127,6 +127,10 @@ var ListAccounts = class {
|
|
|
127
127
|
|
|
128
128
|
error message: ${result.msg}`;
|
|
129
129
|
} else {
|
|
130
|
+
const currentPage = params.pageIndex ?? 1;
|
|
131
|
+
const pageSize = params.pageSize ?? 15;
|
|
132
|
+
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
133
|
+
const hasNextPage = currentPage < totalPages;
|
|
130
134
|
text = `Found ${data.total} accounts in workspace ${params.workspaceId}:
|
|
131
135
|
|
|
132
136
|
${data.rows.map(
|
|
@@ -135,7 +139,14 @@ ${data.rows.map(
|
|
|
135
139
|
- Platform URL: ${account.platformUrl}
|
|
136
140
|
- Remarks: ${account.platformRemarks || "N/A"}
|
|
137
141
|
- Created: ${account.createTime}`
|
|
138
|
-
).join("\n\n")}
|
|
142
|
+
).join("\n\n")}
|
|
143
|
+
|
|
144
|
+
Pagination:
|
|
145
|
+
- currentPage: ${currentPage}
|
|
146
|
+
- pageSize: ${pageSize}
|
|
147
|
+
- totalPages: ${totalPages}
|
|
148
|
+
- hasNextPage: ${hasNextPage}
|
|
149
|
+
${hasNextPage ? `- nextPageHint: Call roxy_list_accounts again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
|
|
139
150
|
}
|
|
140
151
|
return {
|
|
141
152
|
content: [
|
|
@@ -572,13 +583,13 @@ var ProxyList = class {
|
|
|
572
583
|
}
|
|
573
584
|
async handle(params) {
|
|
574
585
|
const searchParams = new URLSearchParams();
|
|
575
|
-
searchParams.append("workspaceId", params.workspaceId);
|
|
586
|
+
searchParams.append("workspaceId", params.workspaceId.toString());
|
|
576
587
|
if (params.id)
|
|
577
|
-
searchParams.append("id", params.id);
|
|
578
|
-
if (params.
|
|
579
|
-
searchParams.append("page_index", params.pageIndex);
|
|
580
|
-
if (params.
|
|
581
|
-
searchParams.append("page_size", params.pageSize);
|
|
588
|
+
searchParams.append("id", params.id.toString());
|
|
589
|
+
if (params.pageIndex)
|
|
590
|
+
searchParams.append("page_index", params.pageIndex.toString());
|
|
591
|
+
if (params.pageSize)
|
|
592
|
+
searchParams.append("page_size", params.pageSize.toString());
|
|
582
593
|
if (!params.workspaceId) {
|
|
583
594
|
throw new Error("workspaceId is required");
|
|
584
595
|
}
|
|
@@ -586,6 +597,10 @@ var ProxyList = class {
|
|
|
586
597
|
let text = "";
|
|
587
598
|
if (result.code === 0) {
|
|
588
599
|
const data = result.data;
|
|
600
|
+
const currentPage = params.pageIndex ?? 1;
|
|
601
|
+
const pageSize = params.pageSize ?? 15;
|
|
602
|
+
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
603
|
+
const hasNextPage = currentPage < totalPages;
|
|
589
604
|
const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
|
|
590
605
|
const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
|
|
591
606
|
const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
|
|
@@ -612,7 +627,14 @@ ${ipInfo.length > 0 ? `${ipInfo.join("")}
|
|
|
612
627
|
}).join("\n\n") : "";
|
|
613
628
|
text = `\u{1F4CB} **proxy list** (total: ${data.total})
|
|
614
629
|
|
|
615
|
-
${proxyListText}
|
|
630
|
+
${proxyListText}
|
|
631
|
+
|
|
632
|
+
Pagination:
|
|
633
|
+
- currentPage: ${currentPage}
|
|
634
|
+
- pageSize: ${pageSize}
|
|
635
|
+
- totalPages: ${totalPages}
|
|
636
|
+
- hasNextPage: ${hasNextPage}
|
|
637
|
+
${hasNextPage ? `- nextPageHint: Call roxy_list_proxies again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
|
|
616
638
|
} else {
|
|
617
639
|
text = `\u274C **get proxy list failed**
|
|
618
640
|
|
|
@@ -659,16 +681,20 @@ var ProxyStore = class {
|
|
|
659
681
|
async handle(params) {
|
|
660
682
|
const searchParams = new URLSearchParams();
|
|
661
683
|
searchParams.append("workspaceId", params.workspaceId.toString());
|
|
662
|
-
if (params.
|
|
663
|
-
searchParams.append("page_index", params.
|
|
664
|
-
if (params.
|
|
665
|
-
searchParams.append("page_size", params.
|
|
684
|
+
if (params.pageIndex)
|
|
685
|
+
searchParams.append("page_index", params.pageIndex.toString());
|
|
686
|
+
if (params.pageSize)
|
|
687
|
+
searchParams.append("page_size", params.pageSize.toString());
|
|
666
688
|
if (params.type)
|
|
667
689
|
searchParams.append("type", params.type.toString());
|
|
668
690
|
const result = await request(`/proxy/bought_list?${searchParams}`);
|
|
669
691
|
let text = "";
|
|
670
692
|
if (result.code === 0) {
|
|
671
693
|
const data = result.data;
|
|
694
|
+
const currentPage = params.pageIndex ?? 1;
|
|
695
|
+
const pageSize = params.pageSize ?? 15;
|
|
696
|
+
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
697
|
+
const hasNextPage = currentPage < totalPages;
|
|
672
698
|
const proxyListText = data.rows.length > 0 ? data.rows.map((proxy, index) => {
|
|
673
699
|
const statusText = proxy.checkStatus === 1 ? "\u2705 available" : proxy.checkStatus === 2 ? "\u274C unavailable" : "\u23F3 not checked";
|
|
674
700
|
const name = `proxy (id: ${proxy.id}) ${proxy.remark ? `remark: ${proxy.remark}` : ""}`;
|
|
@@ -692,7 +718,14 @@ ${ipInfo.join("")}
|
|
|
692
718
|
}).join("\n\n") : "";
|
|
693
719
|
text = `\u{1F4CB} **proxy store** (total: ${data.total})
|
|
694
720
|
|
|
695
|
-
${proxyListText}
|
|
721
|
+
${proxyListText}
|
|
722
|
+
|
|
723
|
+
Pagination:
|
|
724
|
+
- currentPage: ${currentPage}
|
|
725
|
+
- pageSize: ${pageSize}
|
|
726
|
+
- totalPages: ${totalPages}
|
|
727
|
+
- hasNextPage: ${hasNextPage}
|
|
728
|
+
${hasNextPage ? `- nextPageHint: Call roxy_store_proxies again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
|
|
696
729
|
} else {
|
|
697
730
|
text = `\u274C **get proxy store failed**
|
|
698
731
|
|
|
@@ -2131,6 +2164,10 @@ var ListBrowsers = class {
|
|
|
2131
2164
|
|
|
2132
2165
|
error message: ${result.msg}`;
|
|
2133
2166
|
} else {
|
|
2167
|
+
const currentPage = params.pageIndex ?? 1;
|
|
2168
|
+
const pageSize = params.pageSize ?? 15;
|
|
2169
|
+
const totalPages = Math.max(1, Math.ceil((data.total || 0) / pageSize));
|
|
2170
|
+
const hasNextPage = currentPage < totalPages;
|
|
2134
2171
|
text = `Found ${data.total} browsers in workspace ${params.workspaceId}:
|
|
2135
2172
|
|
|
2136
2173
|
${data.rows.map(
|
|
@@ -2139,7 +2176,14 @@ ${data.rows.map(
|
|
|
2139
2176
|
- OSVersion: ${browser.osVersion}
|
|
2140
2177
|
- OS: ${browser.os}
|
|
2141
2178
|
- Remark: ${browser.windowRemark}`
|
|
2142
|
-
).join("\n\n")}
|
|
2179
|
+
).join("\n\n")}
|
|
2180
|
+
|
|
2181
|
+
Pagination:
|
|
2182
|
+
- currentPage: ${currentPage}
|
|
2183
|
+
- pageSize: ${pageSize}
|
|
2184
|
+
- totalPages: ${totalPages}
|
|
2185
|
+
- hasNextPage: ${hasNextPage}
|
|
2186
|
+
${hasNextPage ? `- nextPageHint: Call roxy_list_browsers again with pageIndex=${currentPage + 1}` : "- nextPageHint: No more pages"}`;
|
|
2143
2187
|
}
|
|
2144
2188
|
return {
|
|
2145
2189
|
content: [
|