@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
106 lines (105 loc) • 2.99 kB
TypeScript
/**
* @module Async
*/
import type { AbortAsyncError, RetryAsyncError, TimeoutAsyncError } from "../async/async.errors.js";
import { BaseEvent } from "../event-bus/contracts/_shared.js";
/**
* This event is dispatched when the `LazyPromise` has been rejected.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class FailureAsyncEvent extends BaseEvent<{
error: unknown;
}> {
}
/**
* This event is dispatched when the `LazyPromise` has been fulfilled.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class SuccessAsyncEvent<TValue> extends BaseEvent<{
value: TValue;
}> {
}
/**
* This event is dispatched when the `LazyPromise` has been fulfilled or rejected.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class FinallyAsyncEvent extends BaseEvent<{}> {
}
/**
* This event is dispatched on every retry attempt of the `LazyPromise`.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class RetryAttemptAsyncEvent extends BaseEvent<{
attempt: number;
error: unknown;
}> {
}
/**
* This event is dispatched when the rety attempt of the `LazyPromise` has exceeded the given time limit.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class RetryTimeoutAsyncEvent extends BaseEvent<{
error: TimeoutAsyncError;
}> {
}
/**
* This event is dispatched when the `LazyPromise` has failed all retry attempts.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class RetryFailureAsyncEvent extends BaseEvent<{
error: RetryAsyncError;
}> {
}
/**
* This event is dispatched when `LazyPromise` has exceeded the given total time limit.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class TotalTimeoutFailureAsyncEvent extends BaseEvent<{
error: TimeoutAsyncError;
}> {
}
/**
* This event is dispatched when `LazyPromise` is aborted.
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare class AbortAsyncEvent extends BaseEvent<{
error: AbortAsyncError;
}> {
}
/**
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export declare const ASYNC_EVENTS: {
readonly Failure: typeof FailureAsyncEvent;
readonly Success: typeof SuccessAsyncEvent;
readonly Finally: typeof FinallyAsyncEvent;
readonly RetryAttempt: typeof RetryAttemptAsyncEvent;
readonly RetryTimeout: typeof RetryTimeoutAsyncEvent;
readonly RetryFailure: typeof RetryFailureAsyncEvent;
readonly TotalTimeoutFailure: typeof TotalTimeoutFailureAsyncEvent;
readonly Abort: typeof AbortAsyncEvent;
};
/**
*
* IMPORT_PATH: `"@daiso-tech/core/async"`
* @group Events
*/
export type AsyncEvents<TValue> = FailureAsyncEvent | SuccessAsyncEvent<TValue> | FinallyAsyncEvent | RetryAttemptAsyncEvent | RetryTimeoutAsyncEvent | RetryFailureAsyncEvent | TotalTimeoutFailureAsyncEvent | AbortAsyncEvent;