import { h64 } from "../../shared/src/hash.js";
import { normalizeAST } from "./ast.js";
const hashCache = new WeakMap();
export function hashOfAST(ast) {
    const normalized = normalizeAST(ast);
    const cached = hashCache.get(normalized);
    if (cached) {
        return cached;
    }
    const hash = h64(JSON.stringify(normalized)).toString(36);
    hashCache.set(normalized, hash);
    return hash;
}
export function hashOfNameAndArgs(name, args) {
    const argsString = JSON.stringify(args);
    return h64(`${name}:${argsString}`).toString(36);
}
//# sourceMappingURL=query-hash.js.map