/** * service-api-http — h3 listener for the kiosk-facing REST API. * * Serves pairing, bundle, and kiosk management endpoints at /api/kiosk/* * and /api/pair/*. Port 18081 behind the Angie proxy. */ import * as av from "@anyvali/js"; import { BSBService, type BSBServiceConstructor, createConfigSchema, createEventSchemas, type Observable, } from "@bsb/base"; // ---- Config ----------------------------------------------------------------- const ConfigSchema = av.object( { host: av.string().default("127.0.0.1"), port: av.int().min(1).max(65535).default(18081), }, { unknownKeys: "strip" }, ); export const Config = createConfigSchema( { name: "service-api-http", description: "h3 HTTP server for kiosk-facing REST API.", tags: ["service", "http", "api", "kiosk"], }, ConfigSchema, ); export const EventSchemas = createEventSchemas({ emitEvents: {}, onEvents: {}, emitReturnableEvents: {}, onReturnableEvents: {}, emitBroadcast: {}, onBroadcast: {}, }); // ---- Plugin ----------------------------------------------------------------- export class Plugin extends BSBService, typeof EventSchemas> { static override Config = Config; static override EventSchemas = EventSchemas; initBeforePlugins?: string[]; initAfterPlugins?: string[] = ["service-store", "service-auth"]; runBeforePlugins?: string[]; runAfterPlugins?: string[]; constructor(cfg: BSBServiceConstructor, typeof EventSchemas>) { super(cfg); } async init(_obs: Observable): Promise { // TODO: create h3 app, mount kiosk + pairing routes, start listening } async run(_obs: Observable): Promise {} async dispose(): Promise { // TODO: close h3 listener } }