T-HUB/packages/connector-example/src/index.ts
glass beadian aa5e262f3a 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/.
2026-10-10 11:56:42 +00:00

63 lines
1.7 KiB
TypeScript

/**
* Reference connector: the minimal honest implementation. Every real
* connector copies this shape and fills in a provider API.
*/
import type {
ConnectorCapabilities,
ConnectorConnection,
NormalizedIdentity,
NormalizedPost,
Publication,
} from "@tactical-media-broadcast-hub/core";
import {
assertValidManifest,
type ConnectorManifest,
type PlatformConnector,
} from "@tactical-media-broadcast-hub/connector-sdk";
const CAPABILITIES: ConnectorCapabilities = {
publishText: true,
};
export function createExampleConnector(): PlatformConnector {
const manifest: ConnectorManifest = {
id: "example",
displayName: "Example (reference connector)",
capabilities: CAPABILITIES,
connectionFields: [
{ name: "apiToken", label: "API token", required: true, secret: true },
],
};
return {
manifest: () => {
assertValidManifest(manifest);
return manifest;
},
async authorize() {
throw new Error("example connector does not implement OAuth");
},
async getIdentity(connection: ConnectorConnection): Promise<NormalizedIdentity> {
return {
provider: manifest.id,
remoteId: connection.id,
handle: "example@example",
displayName: "Example Account",
};
},
async publish(connection: ConnectorConnection, post: NormalizedPost): Promise<Publication> {
return {
id: `pub-${post.text.length}`,
workspaceId: connection.workspaceId,
draftId: "direct",
connectionId: connection.id,
remoteId: `remote-${post.text.length}`,
publishedAt: new Date(),
providerMetadata: post.providerMetadata,
};
},
};
}