Tactical Media Broadcast Hub — initial release
Self-hosted multi-platform broadcast newsroom for activist collectives: publishing pipeline with group approval and DST-proof scheduling, TweetDeck-style column wall with hostile-content-safe rendering, live control room with Auto Director, bridged chat governance with polls and quorum, distributed sandboxed transcode workers, encrypted content-addressed archive, monthly analytics. MIT licensed. See README.md and docs/.
This commit is contained in:
commit
aa5e262f3a
880 changed files with 111042 additions and 0 deletions
41
packages/connector-sdk/src/registry.ts
Normal file
41
packages/connector-sdk/src/registry.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import type { PlatformConnector } from "./types.js";
|
||||
import { UnknownProviderError } from "./errors.js";
|
||||
|
||||
export type ConnectorFactory = () => PlatformConnector;
|
||||
|
||||
/**
|
||||
* Provider registry. Adding a connector = registering here; the rest of the
|
||||
* application resolves by provider id and never switches on names.
|
||||
*/
|
||||
export class ConnectorRegistry {
|
||||
private readonly connectors = new Map<string, PlatformConnector>();
|
||||
|
||||
register(connector: PlatformConnector): void {
|
||||
const { id } = connector.manifest();
|
||||
if (this.connectorsHas(id)) {
|
||||
throw new Error(`connector "${id}" already registered`);
|
||||
}
|
||||
this.connectors.set(id, connector);
|
||||
}
|
||||
|
||||
get(providerId: string): PlatformConnector {
|
||||
const connector = this.connectors.get(providerId);
|
||||
if (connector === undefined) throw new UnknownProviderError(providerId);
|
||||
return connector;
|
||||
}
|
||||
|
||||
has(providerId: string): boolean {
|
||||
return this.connectors.has(providerId);
|
||||
}
|
||||
|
||||
list(): PlatformConnector[] {
|
||||
return [...this.connectors.values()];
|
||||
}
|
||||
|
||||
private connectorsHas(id: string): boolean {
|
||||
return this.connectors.has(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const CONNECTOR_REGISTRY = Symbol("CONNECTOR_REGISTRY");
|
||||
Loading…
Add table
Add a link
Reference in a new issue