first commit

This commit is contained in:
2026-10-03 13:40:26 +02:00
parent 732a5b5a16
commit 566f415fa7
555 changed files with 62704 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/** Outbound port: tell the user how a command went (implemented with toasts by the app). */
export abstract class Notifications {
abstract success(message: string): void;
abstract error(message: string): void;
}
/** Message of a failed GraphQL/HTTP call, for the user. */
export function describeError(error: unknown): string {
if (
error &&
typeof error === 'object' &&
'errors' in error &&
Array.isArray((error as { errors: unknown[] }).errors)
) {
return (error as { errors: { message: string }[] }).errors
.map((e) => e.message)
.join('\n');
}
return error instanceof Error ? error.message : String(error);
}
/** The read model is eventually consistent: right after a command, a query may 404 for a few ms. */
export function isNotFound(error: unknown): boolean {
return /not found/i.test(describeError(error));
}