TenantAtlas/apps/platform/.pnpm-store/v10/files/48/9024d722956816f1682d45bd615af4a3e3ffbd0bc65b226984ed2ee11f318bfda9ca85b489c9349c7fedd6a6d45bc6d9e2f47dfa0a595a7428c67827b54b53
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

122 lines
3.1 KiB
Plaintext

import { entityKind } from "../../entity.js";
import { QueryPromise } from "../../query-promise.js";
import {
mapRelationalRow
} from "../../relations.js";
import { tracer } from "../../tracing.js";
class RelationalQueryBuilder {
constructor(fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session) {
this.fullSchema = fullSchema;
this.schema = schema;
this.tableNamesMap = tableNamesMap;
this.table = table;
this.tableConfig = tableConfig;
this.dialect = dialect;
this.session = session;
}
static [entityKind] = "PgRelationalQueryBuilder";
findMany(config) {
return new PgRelationalQuery(
this.fullSchema,
this.schema,
this.tableNamesMap,
this.table,
this.tableConfig,
this.dialect,
this.session,
config ? config : {},
"many"
);
}
findFirst(config) {
return new PgRelationalQuery(
this.fullSchema,
this.schema,
this.tableNamesMap,
this.table,
this.tableConfig,
this.dialect,
this.session,
config ? { ...config, limit: 1 } : { limit: 1 },
"first"
);
}
}
class PgRelationalQuery extends QueryPromise {
constructor(fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session, config, mode) {
super();
this.fullSchema = fullSchema;
this.schema = schema;
this.tableNamesMap = tableNamesMap;
this.table = table;
this.tableConfig = tableConfig;
this.dialect = dialect;
this.session = session;
this.config = config;
this.mode = mode;
}
static [entityKind] = "PgRelationalQuery";
/** @internal */
_prepare(name) {
return tracer.startActiveSpan("drizzle.prepareQuery", () => {
const { query, builtQuery } = this._toSQL();
return this.session.prepareQuery(
builtQuery,
void 0,
name,
true,
(rawRows, mapColumnValue) => {
const rows = rawRows.map(
(row) => mapRelationalRow(this.schema, this.tableConfig, row, query.selection, mapColumnValue)
);
if (this.mode === "first") {
return rows[0];
}
return rows;
}
);
});
}
prepare(name) {
return this._prepare(name);
}
_getQuery() {
return this.dialect.buildRelationalQueryWithoutPK({
fullSchema: this.fullSchema,
schema: this.schema,
tableNamesMap: this.tableNamesMap,
table: this.table,
tableConfig: this.tableConfig,
queryConfig: this.config,
tableAlias: this.tableConfig.tsName
});
}
/** @internal */
getSQL() {
return this._getQuery().sql;
}
_toSQL() {
const query = this._getQuery();
const builtQuery = this.dialect.sqlToQuery(query.sql);
return { query, builtQuery };
}
toSQL() {
return this._toSQL().builtQuery;
}
authToken;
/** @internal */
setToken(token) {
this.authToken = token;
return this;
}
execute() {
return tracer.startActiveSpan("drizzle.operation", () => {
return this._prepare().execute(void 0, this.authToken);
});
}
}
export {
PgRelationalQuery,
RelationalQueryBuilder
};
//# sourceMappingURL=query.js.map