Panels dialog saves a ready I/O port draft on close and keeps an unfinished one; one qualified message-name rule on both sides

This commit is contained in:
2026-10-15 16:49:26 +02:00
parent 9836f3ff5f
commit fa8b178866
6 changed files with 150 additions and 34 deletions
@@ -8,6 +8,19 @@ export function qualify(flow: string, name: string): string {
return name.includes(".") ? name : `${flow}.${name}`
}
/**
* A message named with its flow, as the server checks it wherever a name has
* to arrive qualified (`QUALIFIED_PATTERN` in `flow/messages.py`).
*/
const QUALIFIED_MESSAGE = /^[a-z][a-z0-9_]*(\.[A-Za-z0-9_]+)+$/
/** What is wrong with a name that has to be qualified, or null. */
export function qualifiedProblem(name: string): string | null {
return QUALIFIED_MESSAGE.test(name)
? null
: "Name the message as flow.name: a lowercase flow name, a dot, then letters, digits and underscores"
}
/** The flow a qualified message belongs to. */
export function flowOf(message: string): string {
return message.split(".", 1)[0]