feat: export package to help api consumers (#1624)

This commit is contained in:
Alex Christoffer Rasmussen
2025-09-21 06:53:11 +02:00
committed by Carlos Valente
parent a5d628af0c
commit 5716fc31cf
22 changed files with 773 additions and 49 deletions
@@ -1,5 +1,5 @@
import {
ApiAction,
ApiActionTag,
MessageState,
OffsetMode,
OntimeEvent,
@@ -30,7 +30,7 @@ let lastRequest: Date | null = null;
export function dispatchFromAdapter(tag: string, payload: unknown, _source?: 'osc' | 'ws' | 'http') {
const action = tag.toLowerCase();
const handler = actionHandlers[action as ApiAction];
const handler = actionHandlers[action as ApiActionTag];
lastRequest = new Date();
if (handler) {
@@ -46,7 +46,7 @@ export function getLastRequest() {
type ActionHandler = (payload: unknown) => { payload: unknown };
const actionHandlers: Record<ApiAction, ActionHandler> = {
const actionHandlers: Record<ApiActionTag, ActionHandler> = {
/* General */
version: () => ({ payload: ONTIME_VERSION }),
poll: () => ({