TenantAtlas/apps/platform/.pnpm-store/v10/files/07/2629f763002c8ca586e3991c747ca3b4c5881eb98ca6d4bd9abea23d2b5d4fa318d09f09863d30f79c9898f4e7f576f4a0677d16eee9a692a8fa0cbd0a46df
ahmido 1fec9c6f9d
Some checks failed
Main Confidence / confidence (push) Failing after 45s
feat: compress governance operator outcomes (#253)
## Summary
- introduce surface-aware compressed governance outcomes and reuse the shared truth/explanation seams for operator-first summaries
- apply the compressed outcome hierarchy across baseline, evidence, review, review-pack, canonical review/evidence, and artifact-oriented operation-run surfaces
- expand spec 214 fixtures and Pest coverage, and fix tenant-panel route assertions by generating explicit tenant-panel URLs in the affected Filament tests

## Validation
- `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent`
- focused governance compression suite from `specs/214-governance-outcome-compression/quickstart.md` passed (`68` tests, `445` assertions)
- `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryItemResourceTest.php tests/Feature/Filament/BackupSetUiEnforcementTest.php tests/Feature/Filament/RestoreRunUiEnforcementTest.php` passed (`18` tests, `81` assertions)

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #253
2026-04-19 12:30:36 +00:00

130 lines
3.6 KiB
Plaintext

import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { PgColumn, PgColumnBuilder } from "./common.js";
class PgNumericBuilder extends PgColumnBuilder {
static [entityKind] = "PgNumericBuilder";
constructor(name, precision, scale) {
super(name, "string", "PgNumeric");
this.config.precision = precision;
this.config.scale = scale;
}
/** @internal */
build(table) {
return new PgNumeric(table, this.config);
}
}
class PgNumeric extends PgColumn {
static [entityKind] = "PgNumeric";
precision;
scale;
constructor(table, config) {
super(table, config);
this.precision = config.precision;
this.scale = config.scale;
}
mapFromDriverValue(value) {
if (typeof value === "string") return value;
return String(value);
}
getSQLType() {
if (this.precision !== void 0 && this.scale !== void 0) {
return `numeric(${this.precision}, ${this.scale})`;
} else if (this.precision === void 0) {
return "numeric";
} else {
return `numeric(${this.precision})`;
}
}
}
class PgNumericNumberBuilder extends PgColumnBuilder {
static [entityKind] = "PgNumericNumberBuilder";
constructor(name, precision, scale) {
super(name, "number", "PgNumericNumber");
this.config.precision = precision;
this.config.scale = scale;
}
/** @internal */
build(table) {
return new PgNumericNumber(
table,
this.config
);
}
}
class PgNumericNumber extends PgColumn {
static [entityKind] = "PgNumericNumber";
precision;
scale;
constructor(table, config) {
super(table, config);
this.precision = config.precision;
this.scale = config.scale;
}
mapFromDriverValue(value) {
if (typeof value === "number") return value;
return Number(value);
}
mapToDriverValue = String;
getSQLType() {
if (this.precision !== void 0 && this.scale !== void 0) {
return `numeric(${this.precision}, ${this.scale})`;
} else if (this.precision === void 0) {
return "numeric";
} else {
return `numeric(${this.precision})`;
}
}
}
class PgNumericBigIntBuilder extends PgColumnBuilder {
static [entityKind] = "PgNumericBigIntBuilder";
constructor(name, precision, scale) {
super(name, "bigint", "PgNumericBigInt");
this.config.precision = precision;
this.config.scale = scale;
}
/** @internal */
build(table) {
return new PgNumericBigInt(
table,
this.config
);
}
}
class PgNumericBigInt extends PgColumn {
static [entityKind] = "PgNumericBigInt";
precision;
scale;
constructor(table, config) {
super(table, config);
this.precision = config.precision;
this.scale = config.scale;
}
mapFromDriverValue = BigInt;
mapToDriverValue = String;
getSQLType() {
if (this.precision !== void 0 && this.scale !== void 0) {
return `numeric(${this.precision}, ${this.scale})`;
} else if (this.precision === void 0) {
return "numeric";
} else {
return `numeric(${this.precision})`;
}
}
}
function numeric(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
const mode = config?.mode;
return mode === "number" ? new PgNumericNumberBuilder(name, config?.precision, config?.scale) : mode === "bigint" ? new PgNumericBigIntBuilder(name, config?.precision, config?.scale) : new PgNumericBuilder(name, config?.precision, config?.scale);
}
const decimal = numeric;
export {
PgNumeric,
PgNumericBigInt,
PgNumericBigIntBuilder,
PgNumericBuilder,
PgNumericNumber,
PgNumericNumberBuilder,
decimal,
numeric
};
//# sourceMappingURL=numeric.js.map