TenantAtlas/apps/platform/.pnpm-store/v10/files/e7/0799d29a0b0050f2425d11e53dac00981705b593957156d27036514d946318fb8222bafd1167077049f8b1c03a3a3f2a5ccecf3d207bc348d6bd796ebcbc22
Ahmed Darrazi 9f74f7a658
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 51s
feat: compress governance operator outcomes
2026-04-19 14:15:11 +02:00

32 lines
816 B
Plaintext

import { entityKind } from "../../entity.js";
class Cache {
static [entityKind] = "Cache";
}
class NoopCache extends Cache {
strategy() {
return "all";
}
static [entityKind] = "NoopCache";
async get(_key) {
return void 0;
}
async put(_hashedQuery, _response, _tables, _config) {
}
async onMutate(_params) {
}
}
async function hashQuery(sql, params) {
const dataToHash = `${sql}-${JSON.stringify(params)}`;
const encoder = new TextEncoder();
const data = encoder.encode(dataToHash);
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
const hashArray = [...new Uint8Array(hashBuffer)];
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
return hashHex;
}
export {
Cache,
NoopCache,
hashQuery
};
//# sourceMappingURL=cache.js.map