···1212// 🌳
1313////////////////////////////////////////////
14141515-export type WorkerActions = {
1616- perform: ReturnType<typeof handleWorkerActions>;
1515+export type WorkerTasks = {
1616+ listenForActions: ReturnType<typeof handleWorkerActions>;
1717};
18181919////////////////////////////////////////////
···5959 return xxh32(JSON.stringify(value));
6060}
61616262-export function endpoint<T extends Record<string, any> = WorkerActions>(ini: Comlink.Endpoint) {
6262+export function endpoint<T extends Record<string, any> = WorkerTasks>(ini: Comlink.Endpoint) {
6363 const e = Comlink.wrap<T>(ini);
6464 if ("start" in ini && typeof ini.start === "function") ini.start();
6565 return e;
6666}
67676868-export function expose<A extends Record<string, any>>(actions: A): A {
6868+export function expose<A extends Record<string, any>>(tasks: A): A {
6969 if (globalThis.SharedWorkerGlobalScope && self instanceof SharedWorkerGlobalScope) {
7070 self.onconnect = (event: MessageEvent) => {
7171 const port = event.ports[0];
7272- Comlink.expose(actions, port);
7272+ Comlink.expose(tasks, port);
7373 port.start();
7474 };
75757676 (self as any).connected = true;
7777 } else {
7878- Comlink.expose(actions, self);
7878+ Comlink.expose(tasks, self);
7979 }
80808181- return actions;
8181+ return tasks;
8282}
83838484export function groupTracksPerScheme(
···107107 return new TextEncoder().encode(JSON.stringify(a));
108108}
109109110110-export function provide<A extends Record<string, any>>(actions: A) {
111111- return expose({
112112- perform: handleWorkerActions(actions),
110110+export function provide<A extends Record<string, any>, B extends Record<string, any>>(
111111+ actions: A,
112112+ tasks: B = {} as B,
113113+) {
114114+ return expose<WorkerTasks & B>({
115115+ listenForActions: handleWorkerActions(actions),
116116+ ...tasks,
113117 });
114118}
115119···154158 }
155159156160 return (port: MessagePort) => {
161161+ Comlink.expose(actions, port);
162162+157163 port.onmessage = async (message) => {
158164 switch (message.data?.type) {
159165 case "action":
+6
src/scripts/configurator/input/common.ts
···11+import { CONNECTIONS } from "./constants";
22+import type { Scheme } from "./types";
33+44+export function isSupportedScheme(scheme: string): scheme is Scheme {
55+ return !!CONNECTIONS[scheme as Scheme];
66+}