fix(lint): biome-format tool-factory and json-xml to green apps/api lint (#252)

Collapses the error_message line introduced in #251 plus the pre-existing
preValidate blocks and the json-xml wrapped assignment that were already
failing apps/api lint on main. Pure formatting, no logic change.
This commit is contained in:
SnapOtter
2026-06-16 16:07:15 +08:00
committed by GitHub
parent 08961fcc89
commit 7865339fc8
2 changed files with 4 additions and 10 deletions
+3 -8
View File
@@ -80,9 +80,7 @@ export interface ToolRouteConfig<T> {
* and validated settings; throw InputValidationError to reject with its
* statusCode (default 400) before any job is enqueued (vs a worker 422).
*/
preValidate?: (ctx: {
inputs: { filename: string; buffer: Buffer }[];
}) => Promise<void> | void;
preValidate?: (ctx: { inputs: { filename: string; buffer: Buffer }[] }) => Promise<void> | void;
/**
* Per-position input kind overrides for mixed-input tools (e.g. video +
* subtitle). Input i validates with kind inputKinds[Math.min(i, len-1)].
@@ -121,9 +119,7 @@ export interface AnyToolRouteConfig {
toolId: string;
maxInputs?: number;
minInputs?: number;
preValidate?: (ctx: {
inputs: { filename: string; buffer: Buffer }[];
}) => Promise<void> | void;
preValidate?: (ctx: { inputs: { filename: string; buffer: Buffer }[] }) => Promise<void> | void;
inputKinds?: ("video" | "audio" | "image" | "subtitle")[];
settingsSchema: z.ZodType<unknown, z.ZodTypeDef, unknown>;
process: (
@@ -589,8 +585,7 @@ export function createToolRoute<T>(app: FastifyInstance, config: ToolRouteConfig
category: TOOLS.find((t) => t.id === config.toolId)?.category ?? "unknown",
is_ai_tool: getBundleForTool(config.toolId) !== null,
error_code: err instanceof Error ? err.constructor.name : "UnknownError",
error_message:
err instanceof Error ? err.message.slice(0, 200) : "Processing failed",
error_message: err instanceof Error ? err.message.slice(0, 200) : "Processing failed",
});
return reply.status(422).send({
error: "Processing failed",
+1 -2
View File
@@ -49,8 +49,7 @@ export function registerJsonXml(app: FastifyInstance) {
}
// Wrap in a root element when the top level is an array or has multiple
// keys, so the XML is well-formed with a single root.
const wrapped =
Array.isArray(data) || Object.keys(data).length !== 1 ? { root: data } : data;
const wrapped = Array.isArray(data) || Object.keys(data).length !== 1 ? { root: data } : data;
const builder = new XMLBuilder({ format: settings.pretty, ignoreAttributes: false });
const xml = builder.build(wrapped) as string;
return {