TenantAtlas/apps/platform/.pnpm-store/v10/files/9e/646f6183a0d71e207bc1464323c2fd0ca3f3db40f616c89afd2e452095e931b0f4fae6c6ae49505aca84b51de2e3a1af7e168ec44d404e42dc28f6a894c08a
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

62 lines
2.5 KiB
Plaintext

import { OperatorFunction } from '../types';
import { operate } from '../util/lift';
import { createOperatorSubscriber } from './OperatorSubscriber';
export function map<T, R>(project: (value: T, index: number) => R): OperatorFunction<T, R>;
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
export function map<T, R, A>(project: (this: A, value: T, index: number) => R, thisArg: A): OperatorFunction<T, R>;
/**
* Applies a given `project` function to each value emitted by the source
* Observable, and emits the resulting values as an Observable.
*
* <span class="informal">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),
* it passes each source value through a transformation function to get
* corresponding output values.</span>
*
* ![](map.png)
*
* Similar to the well known `Array.prototype.map` function, this operator
* applies a projection to each value and emits that projection in the output
* Observable.
*
* ## Example
*
* Map every click to the `clientX` position of that click
*
* ```ts
* import { fromEvent, map } from 'rxjs';
*
* const clicks = fromEvent<PointerEvent>(document, 'click');
* const positions = clicks.pipe(map(ev => ev.clientX));
*
* positions.subscribe(x => console.log(x));
* ```
*
* @see {@link mapTo}
* @see {@link pluck}
*
* @param project The function to apply to each `value` emitted by the source
* Observable. The `index` parameter is the number `i` for the i-th emission
* that has happened since the subscription, starting from the number `0`.
* @param thisArg An optional argument to define what `this` is in the
* `project` function.
* @return A function that returns an Observable that emits the values from the
* source Observable transformed by the given `project` function.
*/
export function map<T, R>(project: (value: T, index: number) => R, thisArg?: any): OperatorFunction<T, R> {
return operate((source, subscriber) => {
// The index of the value from the source. Used with projection.
let index = 0;
// Subscribe to the source, all errors and completions are sent along
// to the consumer.
source.subscribe(
createOperatorSubscriber(subscriber, (value: T) => {
// Call the projection function with the appropriate this context,
// and send the resulting value to the consumer.
subscriber.next(project.call(thisArg, value, index++));
})
);
});
}