TenantAtlas/apps/platform/.pnpm-store/v10/files/58/0af603e1c3a1624e403ef527f55b00f7b149305609f997bfade8612c1ba8fa7f23491988a5ef8ee2ea035d7aff5692c5cf0b7cd4212df6b9e03bf0bebb3a94
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

43 lines
900 B
Plaintext

import { entityKind } from "../../entity.js";
import { PgColumn, PgColumnBuilder } from "./common.js";
class PgJsonBuilder extends PgColumnBuilder {
static [entityKind] = "PgJsonBuilder";
constructor(name) {
super(name, "json", "PgJson");
}
/** @internal */
build(table) {
return new PgJson(table, this.config);
}
}
class PgJson extends PgColumn {
static [entityKind] = "PgJson";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return "json";
}
mapToDriverValue(value) {
return JSON.stringify(value);
}
mapFromDriverValue(value) {
if (typeof value === "string") {
try {
return JSON.parse(value);
} catch {
return value;
}
}
return value;
}
}
function json(name) {
return new PgJsonBuilder(name ?? "");
}
export {
PgJson,
PgJsonBuilder,
json
};
//# sourceMappingURL=json.js.map