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

89 lines
3.5 KiB
Plaintext

import { not } from '../util/not';
import { filter } from '../operators/filter';
import { ObservableInput } from '../types';
import { Observable } from '../Observable';
import { innerFrom } from './innerFrom';
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
export function partition<T, U extends T, A>(
source: ObservableInput<T>,
predicate: (this: A, value: T, index: number) => value is U,
thisArg: A
): [Observable<U>, Observable<Exclude<T, U>>];
export function partition<T, U extends T>(
source: ObservableInput<T>,
predicate: (value: T, index: number) => value is U
): [Observable<U>, Observable<Exclude<T, U>>];
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
export function partition<T, A>(
source: ObservableInput<T>,
predicate: (this: A, value: T, index: number) => boolean,
thisArg: A
): [Observable<T>, Observable<T>];
export function partition<T>(source: ObservableInput<T>, predicate: (value: T, index: number) => boolean): [Observable<T>, Observable<T>];
/**
* Splits the source Observable into two, one with values that satisfy a
* predicate, and another with values that don't satisfy the predicate.
*
* <span class="informal">It's like {@link filter}, but returns two Observables:
* one like the output of {@link filter}, and the other with values that did not
* pass the condition.</span>
*
* ![](partition.png)
*
* `partition` outputs an array with two Observables that partition the values
* from the source Observable through the given `predicate` function. The first
* Observable in that array emits source values for which the predicate argument
* returns true. The second Observable emits source values for which the
* predicate returns false. The first behaves like {@link filter} and the second
* behaves like {@link filter} with the predicate negated.
*
* ## Example
*
* Partition a set of numbers into odds and evens observables
*
* ```ts
* import { of, partition } from 'rxjs';
*
* const observableValues = of(1, 2, 3, 4, 5, 6);
* const [evens$, odds$] = partition(observableValues, value => value % 2 === 0);
*
* odds$.subscribe(x => console.log('odds', x));
* evens$.subscribe(x => console.log('evens', x));
*
* // Logs:
* // odds 1
* // odds 3
* // odds 5
* // evens 2
* // evens 4
* // evens 6
* ```
*
* @see {@link filter}
*
* @param source The source `ObservableInput` that will be split into a tuple of
* two Observable elements.
* @param predicate A function that evaluates each value emitted by the source
* Observable. If it returns `true`, the value is emitted on the first Observable
* in the returned array, if `false` the value is emitted on the second Observable
* in the array. The `index` parameter is the number `i` for the i-th source
* emission that has happened since the subscription, starting from the number `0`.
* @param thisArg An optional argument to determine the value of `this` in the
* `predicate` function.
* @return An array with two Observables: one with values that passed the
* predicate, and another with values that did not pass the predicate.
*/
export function partition<T>(
source: ObservableInput<T>,
predicate: (this: any, value: T, index: number) => boolean,
thisArg?: any
): [Observable<T>, Observable<T>] {
return [filter(predicate, thisArg)(innerFrom(source)), filter(not(predicate, thisArg))(innerFrom(source))] as [
Observable<T>,
Observable<T>
];
}