mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 13:41:17 -05:00
e0dcdab1a9
The bridge ceiling lists every Hopper and Ghidra bridge operation plus the Cutter calls, and a test fails when a registry entry is missing. ChangeTime observation and the other launch-seed parsers read an accepted override before rejecting an invalid value.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { AsyncLocalStorage } from "node:async_hooks";
|
|
import type {
|
|
AnalysisSettingValues,
|
|
AnalysisSettingsSnapshot,
|
|
} from "./analysisSettings.js";
|
|
|
|
const snapshots = new AsyncLocalStorage<AnalysisSettingsSnapshot>();
|
|
|
|
/**
|
|
* Bind the snapshot accepted for one operation. Providers and filesystem
|
|
* helpers read it at the point they enforce a limit. A later update does not
|
|
* change work already inside this call.
|
|
*/
|
|
export const runWithAnalysisOperationSnapshot = <Value>(
|
|
snapshot: AnalysisSettingsSnapshot,
|
|
operation: () => Value,
|
|
): Value => snapshots.run(snapshot, operation);
|
|
|
|
/** The snapshot for the operation on this async stack, when one was accepted. */
|
|
export const currentAnalysisOperationSnapshot = ():
|
|
| AnalysisSettingsSnapshot
|
|
| undefined => snapshots.getStore();
|
|
|
|
/** Accepted override for one setting, when this operation has a snapshot. */
|
|
export const currentAnalysisSettingOverride = <
|
|
Setting extends keyof AnalysisSettingValues,
|
|
>(
|
|
setting: Setting,
|
|
): AnalysisSettingValues[Setting] | undefined =>
|
|
currentAnalysisOperationSnapshot()?.overrides[setting];
|