mirror of
https://github.com/BetterCorp/BetterFrame.git
synced 2026-05-27 21:46:34 +00:00
20 lines
600 B
TypeScript
20 lines
600 B
TypeScript
|
|
/**
|
||
|
|
* Module-level store registry — the one cross-plugin reference needed.
|
||
|
|
*
|
||
|
|
* service-store registers its repo in init(). Downstream plugins
|
||
|
|
* (admin-http, api-http, coordinator-ws) look it up in their init().
|
||
|
|
* initAfterPlugins guarantees ordering.
|
||
|
|
*/
|
||
|
|
import type { Repository } from "../plugins/service-store/repository.js";
|
||
|
|
|
||
|
|
let _repo: Repository | undefined;
|
||
|
|
|
||
|
|
export function registerRepo(repo: Repository): void {
|
||
|
|
_repo = repo;
|
||
|
|
}
|
||
|
|
|
||
|
|
export function getRepo(): Repository {
|
||
|
|
if (!_repo) throw new Error("plugin-registry: store repo not registered (init order bug?)");
|
||
|
|
return _repo;
|
||
|
|
}
|