TenantAtlas/apps/platform/.pnpm-store/v10/files/02/50d1f3a4c0d4a88870f58d2ed0bf82d49a7af60ef057248585013254d14c8e0bf1c5f7ed1de540fea2092d7cbe643f5873dda2801f9a0be37ccb1ac6a2af30
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

57 lines
2.2 KiB
Plaintext

import { Observable } from '../Observable';
import { ObservedValueOf, ObservableInput } from '../types';
import { innerFrom } from './innerFrom';
/**
* Creates an Observable that, on subscribe, calls an Observable factory to
* make an Observable for each new Observer.
*
* <span class="informal">Creates the Observable lazily, that is, only when it
* is subscribed.
* </span>
*
* ![](defer.png)
*
* `defer` allows you to create an Observable only when the Observer
* subscribes. It waits until an Observer subscribes to it, calls the given
* factory function to get an Observable -- where a factory function typically
* generates a new Observable -- and subscribes the Observer to this Observable.
* In case the factory function returns a falsy value, then EMPTY is used as
* Observable instead. Last but not least, an exception during the factory
* function call is transferred to the Observer by calling `error`.
*
* ## Example
*
* Subscribe to either an Observable of clicks or an Observable of interval, at random
*
* ```ts
* import { defer, fromEvent, interval } from 'rxjs';
*
* const clicksOrInterval = defer(() => {
* return Math.random() > 0.5
* ? fromEvent(document, 'click')
* : interval(1000);
* });
* clicksOrInterval.subscribe(x => console.log(x));
*
* // Results in the following behavior:
* // If the result of Math.random() is greater than 0.5 it will listen
* // for clicks anywhere on the "document"; when document is clicked it
* // will log a MouseEvent object to the console. If the result is less
* // than 0.5 it will emit ascending numbers, one every second(1000ms).
* ```
*
* @see {@link Observable}
*
* @param observableFactory The Observable factory function to invoke for each
* Observer that subscribes to the output Observable. May also return any
* `ObservableInput`, which will be converted on the fly to an Observable.
* @return An Observable whose Observers' subscriptions trigger an invocation of the
* given Observable factory function.
*/
export function defer<R extends ObservableInput<any>>(observableFactory: () => R): Observable<ObservedValueOf<R>> {
return new Observable<ObservedValueOf<R>>((subscriber) => {
innerFrom(observableFactory()).subscribe(subscriber);
});
}