@voltade/volty 0.1.22 → 0.1.23
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/volty.js +7 -5
- package/package.json +1 -1
package/dist/volty.js
CHANGED
|
@@ -573,7 +573,7 @@ function renderResult(body, json) {
|
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
// src/keys.ts
|
|
576
|
-
var VALUE_FLAGS = new Set(["name", "for", "for-user-id", "expires", "expires-in-days", "families"]);
|
|
576
|
+
var VALUE_FLAGS = new Set(["name", "for", "for-user-id", "expires", "expires-in-days", "families", "cap"]);
|
|
577
577
|
function keysArgv(argv) {
|
|
578
578
|
const out = argv.slice(0, 2);
|
|
579
579
|
const rest = argv.slice(2);
|
|
@@ -592,6 +592,8 @@ function keysArgv(argv) {
|
|
|
592
592
|
out.push("--for-user-id", value);
|
|
593
593
|
else if (flag === "expires")
|
|
594
594
|
out.push("--expires-in-days", value.replace(/d$/, ""));
|
|
595
|
+
else if (flag === "cap")
|
|
596
|
+
out.push("--daily-cap", value);
|
|
595
597
|
else if (flag === "families")
|
|
596
598
|
for (const f of value.split(","))
|
|
597
599
|
out.push("--families", f.trim());
|
|
@@ -652,12 +654,12 @@ import { chmodSync, existsSync as existsSync4, mkdirSync as mkdirSync3, readdirS
|
|
|
652
654
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
653
655
|
async function call(ctx, name, input = {}) {
|
|
654
656
|
const res = await runOp(ctx, { name }, input);
|
|
657
|
+
if (res.status === 422 && res.body?.error?.code === "refused") {
|
|
658
|
+
return { refused: res.body.error.message ?? `${name} refused` };
|
|
659
|
+
}
|
|
655
660
|
if (!res.ok)
|
|
656
661
|
throw new Error(`${name}: ${res.body?.error?.message ?? `HTTP ${res.status}`}`);
|
|
657
|
-
|
|
658
|
-
if (structured?.refused)
|
|
659
|
-
return { refused: res.body.content?.[0]?.text ?? `${name} refused` };
|
|
660
|
-
return { value: structured };
|
|
662
|
+
return { value: res.body.structuredContent };
|
|
661
663
|
}
|
|
662
664
|
async function read(ctx, name, input = {}) {
|
|
663
665
|
const out = await call(ctx, name, input);
|
package/package.json
CHANGED