TenantAtlas/apps/platform/.pnpm-store/v10/files/f7/e5bf5af43b06b07f6d53be5d60c57bbbe2e7b7ba3d7c5689526c5bd9ea0c57eacb53f66b4e450aaaf59fce1e87397d95befe847b8517392c69ed8865ab8f4b
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

91 lines
2.9 KiB
Plaintext

import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { PgColumn } from "./common.js";
import { PgDateColumnBaseBuilder } from "./date.common.js";
class PgTimestampBuilder extends PgDateColumnBaseBuilder {
static [entityKind] = "PgTimestampBuilder";
constructor(name, withTimezone, precision) {
super(name, "date", "PgTimestamp");
this.config.withTimezone = withTimezone;
this.config.precision = precision;
}
/** @internal */
build(table) {
return new PgTimestamp(table, this.config);
}
}
class PgTimestamp extends PgColumn {
static [entityKind] = "PgTimestamp";
withTimezone;
precision;
constructor(table, config) {
super(table, config);
this.withTimezone = config.withTimezone;
this.precision = config.precision;
}
getSQLType() {
const precision = this.precision === void 0 ? "" : ` (${this.precision})`;
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
}
mapFromDriverValue(value) {
if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
return value;
}
mapToDriverValue = (value) => {
return value.toISOString();
};
}
class PgTimestampStringBuilder extends PgDateColumnBaseBuilder {
static [entityKind] = "PgTimestampStringBuilder";
constructor(name, withTimezone, precision) {
super(name, "string", "PgTimestampString");
this.config.withTimezone = withTimezone;
this.config.precision = precision;
}
/** @internal */
build(table) {
return new PgTimestampString(
table,
this.config
);
}
}
class PgTimestampString extends PgColumn {
static [entityKind] = "PgTimestampString";
withTimezone;
precision;
constructor(table, config) {
super(table, config);
this.withTimezone = config.withTimezone;
this.precision = config.precision;
}
getSQLType() {
const precision = this.precision === void 0 ? "" : `(${this.precision})`;
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
}
mapFromDriverValue(value) {
if (typeof value === "string") return value;
const shortened = value.toISOString().slice(0, -1).replace("T", " ");
if (this.withTimezone) {
const offset = value.getTimezoneOffset();
const sign = offset <= 0 ? "+" : "-";
return `${shortened}${sign}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
}
return shortened;
}
}
function timestamp(a, b = {}) {
const { name, config } = getColumnNameAndConfig(a, b);
if (config?.mode === "string") {
return new PgTimestampStringBuilder(name, config.withTimezone ?? false, config.precision);
}
return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
}
export {
PgTimestamp,
PgTimestampBuilder,
PgTimestampString,
PgTimestampStringBuilder,
timestamp
};
//# sourceMappingURL=timestamp.js.map