import { StandardSchemaV1 } from "@standard-schema/spec"; //#region src/types.d.ts /** * A StandardSchema aware channel definition. * Consumers build a registry keyed by channel name. */ type ChannelDef = Record> = { name: Name; events: Events; }; /** * Extract parameters from a template string like "user-{userId}-chat-{chatId}" * Returns an object type with the parameter names as keys */ type ExtractParams = T extends `${string}{${infer P}}${infer Rest}` ? { [K in P]: string } & ExtractParams : {}; /** * Check if a template string has dynamic parameters */ type HasParams = ExtractParams extends {} ? keyof ExtractParams extends never ? false : true : false; /** * Dynamic channel specification for channels with template parameters */ type DynamicChannel