BetterFrame/server/src/shared/plugin-registry.ts
Mitchell R a8b0fbb2bc
refactor: collapse 6 non-service plugins into shared modules
BSB plugins should be actual services (own port, lifecycle, resource
ownership). Moved secrets, auth, pairing, bundle, nodered-bridge, and
cec-relay from plugin folders to shared modules under server/src/shared/.

4 BSB plugins remain: service-store, service-admin-http,
service-api-http, service-coordinator-ws.

service-admin-http now initializes secrets + auth as plain modules in
init() using the store repo from the plugin-registry singleton. No
more setSiblings() hack or inter-plugin wiring.

sec-config.yaml updated: secrets/auth config moved into
service-admin-http, pairing config into service-api-http, nodered
config into service-coordinator-ws.
2026-05-10 02:29:25 +02:00

19 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;
}