@topolo/cli 0.12.15 → 0.12.17
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 +3 -0
- package/dist/index.js +31 -34
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -128,8 +128,11 @@ topolo actions call app_topolo_mail.messages.send --data '{"mailboxId":"primary"
|
|
|
128
128
|
topolo actions upload app_topolo_brand.brand_assets.upload --file ./logo.png --data '{"assetId":"asset_1"}' --confirm
|
|
129
129
|
topolo actions upload app_topolo_chat.uploads.request --file ./launch.mp4 --data '{}' --complete-data '{"conversationKind":"channel","conversationId":"channel_1"}' --confirm
|
|
130
130
|
topolo api mail POST /api/mail/mailboxes/primary/messages --data '{"subject":"Hello"}' --confirm
|
|
131
|
+
topolo api developers POST /api/internal/action-definitions/import --data @./request.json --confirm
|
|
131
132
|
```
|
|
132
133
|
|
|
134
|
+
`--data` on `actions validate|plan|call` and on `api` takes inline JSON or `@<path>` to read the JSON from a UTF-8 file, which keeps large payloads off the command line.
|
|
135
|
+
|
|
133
136
|
`actions upload` requires the resolved action to publish an upload contract. It reads the file, infers common MIME types or accepts `--content-type`, then follows either the declared inline-base64 mapping or the complete initiate/upload/finish URL-session flow. `--complete-data` supplies only fields required by a declared completion action; the upload/session id is mapped from the initiation response by contract.
|
|
134
137
|
|
|
135
138
|
## Commands
|
package/dist/index.js
CHANGED
|
@@ -5025,17 +5025,44 @@ function formatPretty(info) {
|
|
|
5025
5025
|
|
|
5026
5026
|
// src/commands/actions.ts
|
|
5027
5027
|
import { spawn as spawn2 } from "child_process";
|
|
5028
|
-
import { readFileSync as
|
|
5028
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
5029
5029
|
import { platform as platform3 } from "os";
|
|
5030
5030
|
import { basename, extname } from "path";
|
|
5031
5031
|
|
|
5032
|
+
// src/json-input.ts
|
|
5033
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
5034
|
+
function parseJsonInput(value) {
|
|
5035
|
+
let source = value;
|
|
5036
|
+
if (value.startsWith("@")) {
|
|
5037
|
+
const path = value.slice(1);
|
|
5038
|
+
if (!path) throw new Error("--data @file path must not be empty");
|
|
5039
|
+
try {
|
|
5040
|
+
source = readFileSync2(path, "utf8");
|
|
5041
|
+
} catch (err) {
|
|
5042
|
+
throw new Error(`Could not read --data file ${path}: ${err.message}`);
|
|
5043
|
+
}
|
|
5044
|
+
}
|
|
5045
|
+
try {
|
|
5046
|
+
return JSON.parse(source);
|
|
5047
|
+
} catch {
|
|
5048
|
+
throw new Error("--data must be valid JSON");
|
|
5049
|
+
}
|
|
5050
|
+
}
|
|
5051
|
+
function parseJsonObject(value) {
|
|
5052
|
+
const parsed = parseJsonInput(value);
|
|
5053
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
5054
|
+
throw new Error("--data must be a JSON object");
|
|
5055
|
+
}
|
|
5056
|
+
return parsed;
|
|
5057
|
+
}
|
|
5058
|
+
|
|
5032
5059
|
// src/commands/api.ts
|
|
5033
5060
|
var HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
5034
5061
|
var WRITE_METHODS2 = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
5035
5062
|
function registerApiCommand(program2) {
|
|
5036
5063
|
program2.command("api <service> <method> <path>").description(
|
|
5037
5064
|
"Generic passthrough to a Topolo service. Run `topolo services --json` to discover callable services."
|
|
5038
|
-
).option("-d, --data <json>", "JSON body (for POST/PUT/PATCH)").option(
|
|
5065
|
+
).option("-d, --data <json-or-@file>", "JSON body (for POST/PUT/PATCH) or @path to a JSON file").option(
|
|
5039
5066
|
"-q, --query <kv...>",
|
|
5040
5067
|
"Query params as key=value (repeatable), e.g. --query source=cli page=2"
|
|
5041
5068
|
).option("--resource-type <type>", "Cataloged app-local workspace resource alias for resource-scoped API keys").option("--resource-id <id>", "Workspace resource id for resource-scoped API keys").option("--confirm", "Acknowledge a mutating request").option("--json", "Output JSON", true).option("--no-json", "Output human-readable text").action(
|
|
@@ -5059,14 +5086,7 @@ function registerApiCommand(program2) {
|
|
|
5059
5086
|
if (configuredUrl) {
|
|
5060
5087
|
assertServiceUrlForEnvironment(service, configuredUrl, environment);
|
|
5061
5088
|
}
|
|
5062
|
-
|
|
5063
|
-
if (opts.data) {
|
|
5064
|
-
try {
|
|
5065
|
-
body = JSON.parse(opts.data);
|
|
5066
|
-
} catch {
|
|
5067
|
-
throw new Error("--data must be valid JSON");
|
|
5068
|
-
}
|
|
5069
|
-
}
|
|
5089
|
+
const body = opts.data ? parseJsonInput(opts.data) : void 0;
|
|
5070
5090
|
const query = parseQueryPairs(opts.query);
|
|
5071
5091
|
const resource = parseResourceOption(opts.resourceType, opts.resourceId);
|
|
5072
5092
|
const topolo = await buildClient();
|
|
@@ -5214,7 +5234,7 @@ Approval required. ${opened ? "Opening" : "Open"} ${approval.verificationUrl}` :
|
|
|
5214
5234
|
const resource = parseResourceOption(opts.resourceType, opts.resourceId);
|
|
5215
5235
|
const result = await topolo.client.uploadAction(
|
|
5216
5236
|
action,
|
|
5217
|
-
|
|
5237
|
+
readFileSync3(opts.file),
|
|
5218
5238
|
parseJsonObject(opts.data || "{}"),
|
|
5219
5239
|
{
|
|
5220
5240
|
fileName: basename(opts.file),
|
|
@@ -5424,29 +5444,6 @@ async function requiredClient() {
|
|
|
5424
5444
|
if (!topolo) throw new Error("No credential configured. Run `topolo auth login` or set TOPOLO_API_KEY.");
|
|
5425
5445
|
return topolo;
|
|
5426
5446
|
}
|
|
5427
|
-
function parseJsonObject(value) {
|
|
5428
|
-
let source = value;
|
|
5429
|
-
if (value.startsWith("@")) {
|
|
5430
|
-
const path = value.slice(1);
|
|
5431
|
-
if (!path) throw new Error("--data @file path must not be empty");
|
|
5432
|
-
try {
|
|
5433
|
-
source = readFileSync2(path, "utf8");
|
|
5434
|
-
} catch (err) {
|
|
5435
|
-
const detail = err instanceof Error ? err.message : String(err);
|
|
5436
|
-
throw new Error(`Could not read --data file ${path}: ${detail}`);
|
|
5437
|
-
}
|
|
5438
|
-
}
|
|
5439
|
-
let parsed;
|
|
5440
|
-
try {
|
|
5441
|
-
parsed = JSON.parse(source);
|
|
5442
|
-
} catch {
|
|
5443
|
-
throw new Error("--data must be valid JSON");
|
|
5444
|
-
}
|
|
5445
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
5446
|
-
throw new Error("--data must be a JSON object");
|
|
5447
|
-
}
|
|
5448
|
-
return parsed;
|
|
5449
|
-
}
|
|
5450
5447
|
function inferContentType(path) {
|
|
5451
5448
|
return {
|
|
5452
5449
|
".avif": "image/avif",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
3
|
"packageManager": "pnpm@10.17.1",
|
|
4
|
-
"version": "0.12.
|
|
5
|
-
"topoloPublishedVersion": "0.12.
|
|
4
|
+
"version": "0.12.17",
|
|
5
|
+
"topoloPublishedVersion": "0.12.17",
|
|
6
6
|
"description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"author": "Topolo",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
31
|
-
"@topolo/mcp": "0.14.
|
|
32
|
-
"@topolo/sdk": "0.23.
|
|
31
|
+
"@topolo/mcp": "0.14.9",
|
|
32
|
+
"@topolo/sdk": "0.23.4",
|
|
33
33
|
"commander": "^12.1.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|