fix: jq-web -> jq-wasm, includes jq version 1.8.1 (#2223)

Co-authored-by: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> (added tests)
This commit is contained in:
William Floyd
2026-03-06 12:04:41 +00:00
committed by GitHub
co-authored by GCHQDeveloper581
parent cd7dafdf53
commit 0c6454e10c
4 changed files with 26 additions and 18 deletions
+10 -11
View File
@@ -6,7 +6,7 @@
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import jq from "jq-web";
import * as jq from "jq-wasm";
/**
* jq operation
@@ -40,16 +40,15 @@ class Jq extends Operation {
* @returns {string}
*/
run(input, args) {
const [query] = args;
let result;
try {
result = jq.json(input, query);
} catch (err) {
throw new OperationError(`Invalid jq expression: ${err.message}`);
}
return JSON.stringify(result);
return (async () => {
const [query] = args;
try {
const result = await jq.json(input, query);
return JSON.stringify(result);
} catch (err) {
throw new OperationError(`Invalid jq expression: ${err.message}`);
}
})();
}
}