@topolo/cli 0.8.3 → 0.8.4
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 +36 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -764,6 +764,18 @@ function prepareTopoloUrlSessionUploadInput(contractValue, byteLength, input2, o
|
|
|
764
764
|
function topoloUploadResponseValue(response, path) {
|
|
765
765
|
return path.split(".").reduce((value, segment) => isRecord2(value) ? value[segment] : void 0, response);
|
|
766
766
|
}
|
|
767
|
+
function redactTopoloUrlSessionResult(response, uploadUrlPath) {
|
|
768
|
+
const redacted = cloneUploadValue(response);
|
|
769
|
+
let target = redacted;
|
|
770
|
+
const segments = uploadUrlPath.split(".");
|
|
771
|
+
for (const segment of segments.slice(0, -1)) {
|
|
772
|
+
target = isRecord2(target) ? target[segment] : void 0;
|
|
773
|
+
}
|
|
774
|
+
const finalSegment = segments.at(-1);
|
|
775
|
+
if (finalSegment && isRecord2(target) && finalSegment in target) target[finalSegment] = "[REDACTED]";
|
|
776
|
+
redactUploadHeaders(redacted);
|
|
777
|
+
return redacted;
|
|
778
|
+
}
|
|
767
779
|
function decodeTopoloActionBase64(contentBase64) {
|
|
768
780
|
if (!isCanonicalBase64(contentBase64)) {
|
|
769
781
|
throw new TopoloSdkError("invalid_upload_content", "Upload content must be canonical base64.");
|
|
@@ -782,6 +794,28 @@ function mapUploadInput(contract, contentBase64, input2, options) {
|
|
|
782
794
|
[contract.fileNameField]: fileName
|
|
783
795
|
};
|
|
784
796
|
}
|
|
797
|
+
function cloneUploadValue(value) {
|
|
798
|
+
if (Array.isArray(value)) return value.map(cloneUploadValue);
|
|
799
|
+
if (!isRecord2(value)) return value;
|
|
800
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, cloneUploadValue(item)]));
|
|
801
|
+
}
|
|
802
|
+
function redactUploadHeaders(value) {
|
|
803
|
+
if (Array.isArray(value)) {
|
|
804
|
+
value.forEach(redactUploadHeaders);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
if (!isRecord2(value)) return;
|
|
808
|
+
for (const [key, item] of Object.entries(value)) {
|
|
809
|
+
if (key.toLowerCase() === "headers" && isRecord2(item)) {
|
|
810
|
+
for (const header of Object.keys(item)) {
|
|
811
|
+
if (["authorization", "cookie", "set-cookie", "proxy-authorization", "x-api-key"].includes(header.toLowerCase())) {
|
|
812
|
+
item[header] = "[REDACTED]";
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
redactUploadHeaders(item);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
785
819
|
function validateUploadMetadata(contract, byteLength, options) {
|
|
786
820
|
const fileName = options.fileName.trim();
|
|
787
821
|
const contentType = options.contentType.trim().toLowerCase();
|
|
@@ -1423,7 +1457,7 @@ var TopoloClient = class _TopoloClient {
|
|
|
1423
1457
|
throw new TopoloSdkError("invalid_upload_response", `Upload action response is missing ${contract.uploadUrlPath}.`);
|
|
1424
1458
|
}
|
|
1425
1459
|
await this.putUrlSessionContent(entry, uploadUrl, contract.uploadMethod, bytes, options);
|
|
1426
|
-
if (!contract.complete) return initiation;
|
|
1460
|
+
if (!contract.complete) return redactTopoloUrlSessionResult(initiation, contract.uploadUrlPath);
|
|
1427
1461
|
const completionValue = topoloUploadResponseValue(initiation, contract.complete.responsePath);
|
|
1428
1462
|
if (typeof completionValue !== "string" || !completionValue.trim()) {
|
|
1429
1463
|
throw new TopoloSdkError("invalid_upload_response", `Upload action response is missing ${contract.complete.responsePath}.`);
|
|
@@ -3762,6 +3796,7 @@ function inferContentType(path) {
|
|
|
3762
3796
|
".pdf": "application/pdf",
|
|
3763
3797
|
".png": "image/png",
|
|
3764
3798
|
".svg": "image/svg+xml",
|
|
3799
|
+
".txt": "text/plain",
|
|
3765
3800
|
".webp": "image/webp"
|
|
3766
3801
|
}[extname(path).toLowerCase()] ?? null;
|
|
3767
3802
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/cli",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"topoloPublishedVersion": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
|
+
"topoloPublishedVersion": "0.8.4",
|
|
5
5
|
"description": "Public command-line interface for Topolo customer organizations, developers, and agents.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"author": "Topolo",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"dev": "tsup --watch",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
21
|
"start": "node dist/index.js",
|
|
22
|
-
"test": "vitest run",
|
|
22
|
+
"test": "if test \"$TOPOLO_BUILD_READY\" = 1; then vitest run; else python3 ../../tooling/with-resource-lock.py ../topolo-sdk -- sh -c 'pnpm --dir ../topolo-sdk build && exec vitest run'; fi",
|
|
23
23
|
"test:watch": "vitest",
|
|
24
|
-
"coverage": "vitest run --coverage"
|
|
24
|
+
"coverage": "if test \"$TOPOLO_BUILD_READY\" = 1; then vitest run --coverage; else python3 ../../tooling/with-resource-lock.py ../topolo-sdk -- sh -c 'pnpm --dir ../topolo-sdk build && exec vitest run --coverage'; fi"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
28
|
-
"@topolo/mcp": "0.11.
|
|
29
|
-
"@topolo/sdk": "0.11.
|
|
28
|
+
"@topolo/mcp": "0.11.2",
|
|
29
|
+
"@topolo/sdk": "0.11.2",
|
|
30
30
|
"commander": "^12.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|