feat: restructure into XFlow monorepo with Nuxt 4, Modular Onion Monolith, Android client, and Desktop CLI

This commit is contained in:
2026-09-28 10:39:19 +05:00
parent edcd30c829
commit be68f5e130
204 changed files with 24616 additions and 39 deletions
+37
View File
@@ -0,0 +1,37 @@
export class Result<T, E = Error> {
private constructor(
private readonly _isSuccess: boolean,
private readonly _value?: T,
private readonly _error?: E
) {}
public static ok<U>(value: U): Result<U, never> {
return new Result<U, never>(true, value);
}
public static fail<F>(error: F): Result<never, F> {
return new Result<never, F>(false, undefined, error);
}
public get isSuccess(): boolean {
return this._isSuccess;
}
public get isFailure(): boolean {
return !this._isSuccess;
}
public getValue(): T {
if (!this._isSuccess) {
throw new Error(`Cannot get value from failed Result: ${this._error}`);
}
return this._value as T;
}
public getError(): E {
if (this._isSuccess) {
throw new Error("Cannot get error from successful Result");
}
return this._error as E;
}
}