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

108 lines
5.5 KiB
Plaintext

import { type Cache } from "../cache/core/cache.js";
import type { WithCacheConfig } from "../cache/core/types.js";
import { entityKind } from "../entity.js";
import { QueryPromise } from "../query-promise.js";
import type { TablesRelationalConfig } from "../relations.js";
import type { PreparedQuery } from "../session.js";
import type { Query, SQL } from "../sql/sql.js";
import type { SQLiteAsyncDialect, SQLiteSyncDialect } from "./dialect.js";
import { BaseSQLiteDatabase } from "./db.js";
import type { SQLiteRaw } from "./query-builders/raw.js";
import type { SelectedFieldsOrdered } from "./query-builders/select.types.js";
export interface PreparedQueryConfig {
type: 'sync' | 'async';
run: unknown;
all: unknown;
get: unknown;
values: unknown;
execute: unknown;
}
export declare class ExecuteResultSync<T> extends QueryPromise<T> {
private resultCb;
static readonly [entityKind]: string;
constructor(resultCb: () => T);
execute(): Promise<T>;
sync(): T;
}
export type ExecuteResult<TType extends 'sync' | 'async', TResult> = TType extends 'async' ? Promise<TResult> : ExecuteResultSync<TResult>;
export declare abstract class SQLitePreparedQuery<T extends PreparedQueryConfig> implements PreparedQuery {
private mode;
private executeMethod;
protected query: Query;
private cache?;
private queryMetadata?;
private cacheConfig?;
static readonly [entityKind]: string;
constructor(mode: 'sync' | 'async', executeMethod: SQLiteExecuteMethod, query: Query, cache?: Cache | undefined, queryMetadata?: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
} | undefined, cacheConfig?: WithCacheConfig | undefined);
getQuery(): Query;
abstract run(placeholderValues?: Record<string, unknown>): Result<T['type'], T['run']>;
mapRunResult(result: unknown, _isFromBatch?: boolean): unknown;
abstract all(placeholderValues?: Record<string, unknown>): Result<T['type'], T['all']>;
mapAllResult(_result: unknown, _isFromBatch?: boolean): unknown;
abstract get(placeholderValues?: Record<string, unknown>): Result<T['type'], T['get']>;
mapGetResult(_result: unknown, _isFromBatch?: boolean): unknown;
abstract values(placeholderValues?: Record<string, unknown>): Result<T['type'], T['values']>;
execute(placeholderValues?: Record<string, unknown>): ExecuteResult<T['type'], T['execute']>;
mapResult(response: unknown, isFromBatch?: boolean): unknown;
}
export interface SQLiteTransactionConfig {
behavior?: 'deferred' | 'immediate' | 'exclusive';
}
export type SQLiteExecuteMethod = 'run' | 'all' | 'get';
export declare abstract class SQLiteSession<TResultKind extends 'sync' | 'async', TRunResult, TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> {
static readonly [entityKind]: string;
constructor(
/** @internal */
dialect: {
sync: SQLiteSyncDialect;
async: SQLiteAsyncDialect;
}[TResultKind]);
abstract prepareQuery(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][], mapColumnValue?: (value: unknown) => unknown) => unknown, queryMetadata?: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
}, cacheConfig?: WithCacheConfig): SQLitePreparedQuery<PreparedQueryConfig & {
type: TResultKind;
}>;
prepareOneTimeQuery(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][], mapColumnValue?: (value: unknown) => unknown) => unknown, queryMetadata?: {
type: 'select' | 'update' | 'delete' | 'insert';
tables: string[];
}, cacheConfig?: WithCacheConfig): SQLitePreparedQuery<PreparedQueryConfig & {
type: TResultKind;
}>;
abstract transaction<T>(transaction: (tx: SQLiteTransaction<TResultKind, TRunResult, TFullSchema, TSchema>) => Result<TResultKind, T>, config?: SQLiteTransactionConfig): Result<TResultKind, T>;
run(query: SQL): Result<TResultKind, TRunResult>;
all<T = unknown>(query: SQL): Result<TResultKind, T[]>;
get<T = unknown>(query: SQL): Result<TResultKind, T>;
values<T extends any[] = unknown[]>(query: SQL): Result<TResultKind, T[]>;
count(sql: SQL): Promise<number>;
}
export type Result<TKind extends 'sync' | 'async', TResult> = {
sync: TResult;
async: Promise<TResult>;
}[TKind];
export type DBResult<TKind extends 'sync' | 'async', TResult> = {
sync: TResult;
async: SQLiteRaw<TResult>;
}[TKind];
export declare abstract class SQLiteTransaction<TResultType extends 'sync' | 'async', TRunResult, TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends BaseSQLiteDatabase<TResultType, TRunResult, TFullSchema, TSchema> {
protected schema: {
fullSchema: Record<string, unknown>;
schema: TSchema;
tableNamesMap: Record<string, string>;
} | undefined;
protected readonly nestedIndex: number;
static readonly [entityKind]: string;
constructor(resultType: TResultType, dialect: {
sync: SQLiteSyncDialect;
async: SQLiteAsyncDialect;
}[TResultType], session: SQLiteSession<TResultType, TRunResult, TFullSchema, TSchema>, schema: {
fullSchema: Record<string, unknown>;
schema: TSchema;
tableNamesMap: Record<string, string>;
} | undefined, nestedIndex?: number);
rollback(): never;
}