feat: define housekeeping foundation contracts

This commit is contained in:
Simo committed 2026-08-25 19:06:23 +02:00
1 parent 3b3d7780c9
commit 7d62a04f0e
10 files changed
+338

No files matched your search

@@ -0,0 +1,28 @@
export type HousekeepingErrorCode =
| "VALIDATION_FAILED"
| "AUTHENTICATION_REQUIRED"
| "CAPABILITY_DENIED"
| "NOT_FOUND"
| "CONFLICT"
| "DEPENDENCY_UNAVAILABLE"
| "PARTIAL_RESULT"
| "INTERNAL_ERROR";
export type HousekeepingResult<T> =
| { ok: true; data: T; correlationId: string }
| {
ok: false;
error: { code: HousekeepingErrorCode };
correlationId: string;
};
export function ok<T>(data: T, correlationId: string): HousekeepingResult<T> {
return { ok: true, data, correlationId };
}
export function fail(
code: HousekeepingErrorCode,
correlationId: string,
): HousekeepingResult<never> {
return { ok: false, error: { code }, correlationId };
}