@withone/cli 1.43.3 → 1.43.5
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/bin/cli.js +3 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +26 -12
- package/package.json +9 -2
package/bin/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
import {
|
|
3
2
|
ApiError,
|
|
4
3
|
FLOW_SCHEMA,
|
|
@@ -114,7 +113,7 @@ import {
|
|
|
114
113
|
writeConfig
|
|
115
114
|
} from "./chunk-AU2ZEEMS.js";
|
|
116
115
|
|
|
117
|
-
// src/
|
|
116
|
+
// src/cli.ts
|
|
118
117
|
import { createRequire as createRequire2 } from "module";
|
|
119
118
|
import path12 from "path";
|
|
120
119
|
import { Command } from "commander";
|
|
@@ -485,7 +484,7 @@ async function configCommand() {
|
|
|
485
484
|
let isValid = false;
|
|
486
485
|
try {
|
|
487
486
|
const api = new OneApi(apiKey, `${normalized}/v1`);
|
|
488
|
-
isValid = await api.validateApiKey();
|
|
487
|
+
isValid = Boolean(await api.validateApiKey());
|
|
489
488
|
} catch (err) {
|
|
490
489
|
spinner5.stop("Connection failed");
|
|
491
490
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -521,7 +520,7 @@ async function configCommand() {
|
|
|
521
520
|
let isValid = false;
|
|
522
521
|
try {
|
|
523
522
|
const api = new OneApi(apiKey, "https://api.withone.ai/v1");
|
|
524
|
-
isValid = await api.validateApiKey();
|
|
523
|
+
isValid = Boolean(await api.validateApiKey());
|
|
525
524
|
} catch (err) {
|
|
526
525
|
spinner5.stop("Connection failed");
|
|
527
526
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -1979,8 +1978,9 @@ async function connectionListCommand(options) {
|
|
|
1979
1978
|
const accessFiltered = allowedKeys.includes("*") ? allConnections : allConnections.filter((conn) => allowedKeys.includes(conn.key));
|
|
1980
1979
|
const searchQuery = options?.search?.toLowerCase();
|
|
1981
1980
|
const filtered = searchQuery ? accessFiltered.filter((conn) => conn.platform.toLowerCase().includes(searchQuery)) : accessFiltered;
|
|
1981
|
+
const limitArg = options?.limit ? parseInt(options.limit, 10) : void 0;
|
|
1982
1982
|
if (isAgentMode()) {
|
|
1983
|
-
const limit =
|
|
1983
|
+
const limit = limitArg ?? 20;
|
|
1984
1984
|
const limited = filtered.slice(0, limit);
|
|
1985
1985
|
json({
|
|
1986
1986
|
total: filtered.length,
|
|
@@ -1999,6 +1999,7 @@ async function connectionListCommand(options) {
|
|
|
1999
1999
|
});
|
|
2000
2000
|
return;
|
|
2001
2001
|
}
|
|
2002
|
+
const displayed = limitArg !== void 0 ? filtered.slice(0, limitArg) : filtered;
|
|
2002
2003
|
spinner5.stop(`${filtered.length} connection${filtered.length === 1 ? "" : "s"} found`);
|
|
2003
2004
|
if (filtered.length === 0) {
|
|
2004
2005
|
if (searchQuery) {
|
|
@@ -2019,7 +2020,7 @@ Add one with: ${pc4.cyan("one connection add gmail")}`,
|
|
|
2019
2020
|
return;
|
|
2020
2021
|
}
|
|
2021
2022
|
console.log();
|
|
2022
|
-
const rows =
|
|
2023
|
+
const rows = displayed.map((conn) => ({
|
|
2023
2024
|
status: getStatusIndicator(conn.state),
|
|
2024
2025
|
platform: conn.platform,
|
|
2025
2026
|
state: conn.state,
|
|
@@ -2038,7 +2039,14 @@ Add one with: ${pc4.cyan("one connection add gmail")}`,
|
|
|
2038
2039
|
rows
|
|
2039
2040
|
);
|
|
2040
2041
|
console.log();
|
|
2041
|
-
|
|
2042
|
+
if (displayed.length < filtered.length) {
|
|
2043
|
+
p4.note(
|
|
2044
|
+
`Showing ${displayed.length} of ${filtered.length}. Increase --limit or run without it to see all.`,
|
|
2045
|
+
"Limited"
|
|
2046
|
+
);
|
|
2047
|
+
} else {
|
|
2048
|
+
p4.note(`Add more with: ${pc4.cyan("one connection add <platform>")}`, "Tip");
|
|
2049
|
+
}
|
|
2042
2050
|
} catch (error2) {
|
|
2043
2051
|
spinner5.stop("Failed to load connections");
|
|
2044
2052
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
@@ -2856,7 +2864,11 @@ async function actionsExecuteParallelCommand() {
|
|
|
2856
2864
|
else headers = r.value;
|
|
2857
2865
|
}
|
|
2858
2866
|
if (actionDetails && !flags.skipValidation && segErrors.length === 0) {
|
|
2859
|
-
const validation = validateActionInput(actionDetails, {
|
|
2867
|
+
const validation = validateActionInput(actionDetails, {
|
|
2868
|
+
data,
|
|
2869
|
+
pathVariables,
|
|
2870
|
+
queryParams
|
|
2871
|
+
});
|
|
2860
2872
|
if (!validation.valid) {
|
|
2861
2873
|
for (const m of validation.missing) {
|
|
2862
2874
|
segErrors.push(`Missing ${m.flag} "${m.param}"${m.description ? ` \u2014 ${m.description}` : ""}`);
|
|
@@ -10619,7 +10631,7 @@ async function logoutCommand() {
|
|
|
10619
10631
|
p9.outro("Logged out.");
|
|
10620
10632
|
}
|
|
10621
10633
|
|
|
10622
|
-
// src/
|
|
10634
|
+
// src/cli.ts
|
|
10623
10635
|
var require3 = createRequire2(import.meta.url);
|
|
10624
10636
|
var { version } = require3("../package.json");
|
|
10625
10637
|
var program = new Command();
|
|
@@ -11052,7 +11064,9 @@ program.command("whoami").description("Show the user, organization, and project
|
|
|
11052
11064
|
program.command("add [platform]").description("Shortcut for: connection add").action(async (platform) => {
|
|
11053
11065
|
await connectionAddCommand(platform);
|
|
11054
11066
|
});
|
|
11055
|
-
program.command("list").alias("ls").description("Shortcut for: connection list").action(async () => {
|
|
11056
|
-
await connectionListCommand();
|
|
11067
|
+
program.command("list").alias("ls").description("Shortcut for: connection list").option("-s, --search <query>", "Filter connections by platform name").option("-l, --limit <n>", "Max connections to return (agent mode default: 20)").action(async (options) => {
|
|
11068
|
+
await connectionListCommand(options);
|
|
11057
11069
|
});
|
|
11058
|
-
|
|
11070
|
+
export {
|
|
11071
|
+
program
|
|
11072
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@withone/cli",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.5",
|
|
4
4
|
"description": "CLI for managing One",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -12,12 +12,19 @@
|
|
|
12
12
|
"bin": {
|
|
13
13
|
"one": "./bin/cli.js"
|
|
14
14
|
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
15
21
|
"scripts": {
|
|
16
22
|
"build": "tsup",
|
|
17
23
|
"dev": "tsup --watch",
|
|
18
24
|
"start": "node bin/cli.js",
|
|
19
25
|
"typecheck": "tsc --noEmit",
|
|
20
|
-
"test": "tsx --test \"src/**/*.test.ts\""
|
|
26
|
+
"test": "tsx --test \"src/**/*.test.ts\"",
|
|
27
|
+
"prepare": "tsup"
|
|
21
28
|
},
|
|
22
29
|
"dependencies": {
|
|
23
30
|
"@clack/prompts": "^0.9.1",
|