mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 20:32:20 +03:00
- CHANGELOG: complete v3.8.23 section (28 bullets, 27 commits) - fix(webdav): resolve promise on writeStream finish, not req end — eliminates intermittent 500 on PUT update (writeStream may not have flushed at rename time) - test(autoCombo): stub DB calls from PR #3660 in tieredRotation.test.ts to prevent 5s timeout in vitest (getModelIntelligenceBySource DB init path) - chore(env-sync): add XDG_DATA_HOME + OMNIROUTE_OPENCODE_PLUGIN_DIR to IGNORE_FROM_CODE allowlist (introduced by PR #3726 setup-open-code.mjs, not OmniRoute config vars) - chore(cli): regenerated bin/cli/api-commands/*.mjs (7 new, 27 updated)
129 lines
5.6 KiB
JavaScript
129 lines
5.6 KiB
JavaScript
// AUTO-GENERATED from docs/reference/openapi.yaml. Do not edit.
|
|
import { apiFetch } from "../api.mjs";
|
|
import { emit } from "../output.mjs";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
export function register_compression(parent) {
|
|
const tag = parent.command("compression").description("Compression endpoints");
|
|
tag.command("get-api-settings-compression")
|
|
.description("Get global compression settings")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/settings/compression";
|
|
const res = await apiFetch(url, { method: "GET", baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("put-api-settings-compression")
|
|
.description("Update global compression settings")
|
|
.option("--body <jsonOrPath>", "JSON body or @path/to/file.json")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/settings/compression";
|
|
let body;
|
|
if (opts.body) {
|
|
body = opts.body.startsWith("@")
|
|
? JSON.parse(readFileSync(opts.body.slice(1), "utf8"))
|
|
: JSON.parse(opts.body);
|
|
}
|
|
const res = await apiFetch(url, { method: "PUT", body, baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("post-api-compression-preview")
|
|
.description("Preview compression for a message payload")
|
|
.option("--body <jsonOrPath>", "JSON body or @path/to/file.json")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/compression/preview";
|
|
let body;
|
|
if (opts.body) {
|
|
body = opts.body.startsWith("@")
|
|
? JSON.parse(readFileSync(opts.body.slice(1), "utf8"))
|
|
: JSON.parse(opts.body);
|
|
}
|
|
const res = await apiFetch(url, { method: "POST", body, baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("get-api-compression-language-packs")
|
|
.description("List Caveman compression language packs")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/compression/language-packs";
|
|
const res = await apiFetch(url, { method: "GET", baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("get-api-compression-rules")
|
|
.description("List Caveman compression rule metadata")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/compression/rules";
|
|
const res = await apiFetch(url, { method: "GET", baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("get-api-context-rtk-config")
|
|
.description("Get RTK compression settings")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/context/rtk/config";
|
|
const res = await apiFetch(url, { method: "GET", baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("put-api-context-rtk-config")
|
|
.description("Update RTK compression settings")
|
|
.option("--body <jsonOrPath>", "JSON body or @path/to/file.json")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/context/rtk/config";
|
|
let body;
|
|
if (opts.body) {
|
|
body = opts.body.startsWith("@")
|
|
? JSON.parse(readFileSync(opts.body.slice(1), "utf8"))
|
|
: JSON.parse(opts.body);
|
|
}
|
|
const res = await apiFetch(url, { method: "PUT", body, baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("get-api-context-rtk-filters")
|
|
.description("List RTK filters and load diagnostics")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/context/rtk/filters";
|
|
const res = await apiFetch(url, { method: "GET", baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("post-api-context-rtk-test")
|
|
.description("Run RTK compression preview for text")
|
|
.option("--body <jsonOrPath>", "JSON body or @path/to/file.json")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/context/rtk/test";
|
|
let body;
|
|
if (opts.body) {
|
|
body = opts.body.startsWith("@")
|
|
? JSON.parse(readFileSync(opts.body.slice(1), "utf8"))
|
|
: JSON.parse(opts.body);
|
|
}
|
|
const res = await apiFetch(url, { method: "POST", body, baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
tag.command("get-api-context-rtk-raw-output-id-")
|
|
.description("Read retained redacted RTK raw output")
|
|
.requiredOption("--id <id>", "")
|
|
.action(async (opts, cmd) => {
|
|
const gOpts = cmd.optsWithGlobals();
|
|
let url = "/api/context/rtk/raw-output/{id}";
|
|
url = url.replace("{id}", encodeURIComponent(opts.id ?? ""));
|
|
const res = await apiFetch(url, { method: "GET", baseUrl: gOpts.baseUrl, apiKey: gOpts.apiKey });
|
|
const data = res.ok ? await res.json() : await res.text();
|
|
emit(data, gOpts);
|
|
});
|
|
}
|