import { ExclusiveLoadingError, LoadingModel } from './Loading.js'; import { Getter } from '../types/index.js'; import { PromiseExtended } from '../structures/promiseExtended.js'; import { Loggable } from '../logger/loggable.js'; export type ActionRunOptions = { /** Action name, required for logging and joining. */ name?: string; /** If set to truthy, will not start this action if another is still in progress. * Additionally, if set to 'throw', will throw an error. Otherwise, will return undefined. * * Note: if a current action runs in an exclusive mode, but the next one is not, the next one will still be allowed. */ exclusive?: boolean | 'throw'; /** If an action with the same name (should be specified) runs already, this action is skipped: * - 'cancel' - this action is skipped immediately, no result returned; * - 'merge' - this action waits for the previous one to finish and returns its result; */ join?: 'merge' | 'cancel'; /** If set to true, loading indicator will not be increased, and exclusiveness will not be checked. */ noLoading?: boolean; /** Whether to disable logging for the action. */ noLogs?: boolean; }; export declare class LogicModel extends Loggable { protected readonly _loading: LoadingModel; get isLoading(): boolean; private readonly _namedRunners; private readonly _runningActionNames; constructor(useFirstInit?: boolean); protected getLoggerName(name?: string): string; protected pureConstructLoadingModel(useFirstInit: boolean): LoadingModel; protected runAction(worker: () => Promise, options?: ActionRunOptions, errorCtx?: Getter): ActionResult; } export type ActionResult = Record> = ReturnType>; export declare namespace ActionResult { type Expect = { exclusive: ExclusiveLoadingError; }; namespace Expect { const Config: { readonly name: "exclusive"; readonly ErrCtor: typeof ExclusiveLoadingError; }; } const expectExclusive: >(promise: PromiseExtended, processor?: ((error: ExclusiveLoadingError) => void | Partial>) | undefined) => PromiseExtended>; function createSucceeded(data: T): ActionResult; }