@withone/cli 1.12.5 → 1.12.6
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/dist/index.js +52 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -348,8 +348,16 @@ var OneApi = class {
|
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
async listConnections() {
|
|
351
|
-
const
|
|
352
|
-
|
|
351
|
+
const allConnections = [];
|
|
352
|
+
let page = 1;
|
|
353
|
+
let totalPages = 1;
|
|
354
|
+
do {
|
|
355
|
+
const response = await this.request(`/vault/connections?page=${page}&limit=100`);
|
|
356
|
+
allConnections.push(...response.rows || []);
|
|
357
|
+
totalPages = response.pages || 1;
|
|
358
|
+
page++;
|
|
359
|
+
} while (page <= totalPages);
|
|
360
|
+
return allConnections;
|
|
353
361
|
}
|
|
354
362
|
async listPlatforms() {
|
|
355
363
|
const allPlatforms = [];
|
|
@@ -1318,16 +1326,16 @@ ${pc3.cyan(getApiKeyUrl())}`, "API Key");
|
|
|
1318
1326
|
}
|
|
1319
1327
|
function printBanner() {
|
|
1320
1328
|
console.log();
|
|
1321
|
-
console.log(pc3.
|
|
1322
|
-
console.log(pc3.
|
|
1323
|
-
console.log(pc3.
|
|
1324
|
-
console.log(pc3.
|
|
1325
|
-
console.log(pc3.
|
|
1326
|
-
console.log(pc3.
|
|
1327
|
-
console.log(pc3.
|
|
1328
|
-
console.log(pc3.
|
|
1329
|
-
console.log(pc3.
|
|
1330
|
-
console.log(pc3.
|
|
1329
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"));
|
|
1330
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"));
|
|
1331
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 "));
|
|
1332
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 "));
|
|
1333
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "));
|
|
1334
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "));
|
|
1335
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 "));
|
|
1336
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 "));
|
|
1337
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"));
|
|
1338
|
+
console.log(pc3.yellow(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588"));
|
|
1331
1339
|
console.log();
|
|
1332
1340
|
console.log(pc3.dim(" U N I V E R S A L I N T E G R A T I O N S F O R A I"));
|
|
1333
1341
|
console.log();
|
|
@@ -1581,7 +1589,7 @@ Try again with: ${pc4.cyan(`one connection add ${platform}`)}`,
|
|
|
1581
1589
|
process.exit(1);
|
|
1582
1590
|
}
|
|
1583
1591
|
}
|
|
1584
|
-
async function connectionListCommand() {
|
|
1592
|
+
async function connectionListCommand(options) {
|
|
1585
1593
|
const apiKey = getApiKey();
|
|
1586
1594
|
if (!apiKey) {
|
|
1587
1595
|
error("Not configured. Run `one init` first.");
|
|
@@ -1590,29 +1598,48 @@ async function connectionListCommand() {
|
|
|
1590
1598
|
const spinner5 = createSpinner();
|
|
1591
1599
|
spinner5.start("Loading connections...");
|
|
1592
1600
|
try {
|
|
1593
|
-
const
|
|
1601
|
+
const allConnections = await api.listConnections();
|
|
1602
|
+
const searchQuery = options?.search?.toLowerCase();
|
|
1603
|
+
const filtered = searchQuery ? allConnections.filter((conn) => conn.platform.toLowerCase().includes(searchQuery)) : allConnections;
|
|
1594
1604
|
if (isAgentMode()) {
|
|
1605
|
+
const limit = options?.limit ? parseInt(options.limit, 10) : 20;
|
|
1606
|
+
const limited = filtered.slice(0, limit);
|
|
1595
1607
|
json({
|
|
1596
|
-
|
|
1608
|
+
total: filtered.length,
|
|
1609
|
+
showing: limited.length,
|
|
1610
|
+
...searchQuery && { search: searchQuery },
|
|
1611
|
+
connections: limited.map((conn) => ({
|
|
1597
1612
|
platform: conn.platform,
|
|
1598
1613
|
state: conn.state,
|
|
1599
1614
|
key: conn.key
|
|
1600
|
-
}))
|
|
1615
|
+
})),
|
|
1616
|
+
...limited.length < filtered.length && {
|
|
1617
|
+
hint: `Showing ${limited.length} of ${filtered.length} connections. Use --search <query> to filter by platform or --limit <n> to see more.`
|
|
1618
|
+
}
|
|
1601
1619
|
});
|
|
1602
1620
|
return;
|
|
1603
1621
|
}
|
|
1604
|
-
spinner5.stop(`${
|
|
1605
|
-
if (
|
|
1606
|
-
|
|
1607
|
-
|
|
1622
|
+
spinner5.stop(`${filtered.length} connection${filtered.length === 1 ? "" : "s"} found`);
|
|
1623
|
+
if (filtered.length === 0) {
|
|
1624
|
+
if (searchQuery) {
|
|
1625
|
+
p4.note(
|
|
1626
|
+
`No connections matching "${searchQuery}".
|
|
1627
|
+
|
|
1628
|
+
Try: ${pc4.cyan("one connection list")} to see all connections.`,
|
|
1629
|
+
"No Results"
|
|
1630
|
+
);
|
|
1631
|
+
} else {
|
|
1632
|
+
p4.note(
|
|
1633
|
+
`No connections yet.
|
|
1608
1634
|
|
|
1609
1635
|
Add one with: ${pc4.cyan("one connection add gmail")}`,
|
|
1610
|
-
|
|
1611
|
-
|
|
1636
|
+
"No Connections"
|
|
1637
|
+
);
|
|
1638
|
+
}
|
|
1612
1639
|
return;
|
|
1613
1640
|
}
|
|
1614
1641
|
console.log();
|
|
1615
|
-
const rows =
|
|
1642
|
+
const rows = filtered.map((conn) => ({
|
|
1616
1643
|
status: getStatusIndicator(conn.state),
|
|
1617
1644
|
platform: conn.platform,
|
|
1618
1645
|
state: conn.state,
|
|
@@ -4433,8 +4460,8 @@ var connection = program.command("connection").description("Manage connections")
|
|
|
4433
4460
|
connection.command("add [platform]").alias("a").description("Add a new connection").action(async (platform) => {
|
|
4434
4461
|
await connectionAddCommand(platform);
|
|
4435
4462
|
});
|
|
4436
|
-
connection.command("list").alias("ls").description("List your connections").action(async () => {
|
|
4437
|
-
await connectionListCommand();
|
|
4463
|
+
connection.command("list").alias("ls").description("List your connections").option("-s, --search <query>", "Filter connections by platform name").option("-l, --limit <n>", "Max connections to return (agent mode default: 20)").action(async (options) => {
|
|
4464
|
+
await connectionListCommand(options);
|
|
4438
4465
|
});
|
|
4439
4466
|
program.command("platforms").alias("p").description("List available platforms").option("-c, --category <category>", "Filter by category").option("--json", "Output as JSON").action(async (options) => {
|
|
4440
4467
|
await platformsCommand(options);
|