@thisisagile/easy
Version:
Straightforward library for building domain-driven microservice architectures
29 lines (28 loc) • 1.8 kB
TypeScript
import { ErrorOrigin } from '../types/ErrorOrigin';
import { List } from '../types/List';
type Pro<A> = A | PromiseLike<A>;
type Aw<A> = Awaited<A>;
export declare const resolve: <S = unknown>(subject: S | PromiseLike<S>) => Promise<S>;
export declare const reject: <S = never>(e: ErrorOrigin) => Promise<S>;
export declare const tuple: {
2: <F, S>(first: Pro<F>, second: Pro<S>) => Promise<[Aw<F>, Aw<S>]>;
3: <F, S, T>(first: Pro<F>, second: Pro<S>, third: Pro<T>) => Promise<[Aw<F>, Aw<S>, Aw<T>]>;
4: <F, S, T, Fo>(first: Pro<F>, second: Pro<S>, third: Pro<T>, forth: Pro<Fo>) => Promise<[Aw<F>, Aw<S>, Aw<T>, Aw<Fo>]>;
5: <F, S, T, Fo, Fi>(first: Pro<F>, second: Pro<S>, third: Pro<T>, forth: Pro<Fo>, fifth: Pro<Fi>) => Promise<[Aw<F>, Aw<S>, Aw<T>, Aw<Fo>, Aw<Fi>]>;
all: <F, S>(first: Pro<F>, second: Pro<S>[]) => Promise<[Aw<F>, Aw<S[]>]>;
spread: <F, S>(first: Pro<F>, ...second: Pro<S>[]) => Promise<[Aw<F>, Aw<S[]>]>;
list: <T>(list: Pro<T>[]) => Promise<List<Aw<T>>>;
settled: <T>(list: Pro<T>[]) => Promise<{
fulfilled: List<Aw<T>>;
rejected: List<string>;
}>;
};
export declare const tuple2: <F, S>(first: Pro<F>, second: Pro<S>) => Promise<[Aw<F>, Aw<S>]>;
export declare const tuple3: <F, S, T>(first: Pro<F>, second: Pro<S>, third: Pro<T>) => Promise<[Aw<F>, Aw<S>, Aw<T>]>;
export declare const tuple4: <F, S, T, Fo>(first: Pro<F>, second: Pro<S>, third: Pro<T>, forth: Pro<Fo>) => Promise<[Aw<F>, Aw<S>, Aw<T>, Aw<Fo>]>;
export declare const tuple5: <F, S, T, Fo, Fi>(first: Pro<F>, second: Pro<S>, third: Pro<T>, forth: Pro<Fo>, fifth: Pro<Fi>) => Promise<[Aw<F>, Aw<S>, Aw<T>, Aw<Fo>, Aw<Fi>]>;
export declare const settled: <T>(list: Pro<T>[]) => Promise<{
fulfilled: List<Aw<T>>;
rejected: List<string>;
}>;
export {};