@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.
126 lines (125 loc) • 3.66 kB
TypeScript
/**
* @module Lock
*/
import { BaseEvent } from "../../event-bus/contracts/_module-exports.js";
import type { IFlexibleSerde } from "../../serde/contracts/_module-exports.js";
import type { OneOrMore } from "../../utilities/_module-exports.js";
import { type TimeSpan } from "../../utilities/_module-exports.js";
/**
* The event is dispatched when a lock is aquired.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class KeyAcquiredLockEvent extends BaseEvent<{
key: string;
owner: string;
ttl: TimeSpan | null;
}> {
}
/**
* The event is dispatched when a lock is released.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class KeyReleasedLockEvent extends BaseEvent<{
key: string;
owner: string;
}> {
}
/**
* The event is dispatched when a lock is forcefully released.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class KeyForceReleasedLockEvent extends BaseEvent<{
key: string;
}> {
}
/**
* The event is dispatched when trying to release a lock that is owned by a different owner.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class UnownedReleaseLockEvent extends BaseEvent<{
key: string;
owner: string;
}> {
}
/**
* The event is dispatched when trying to refefresh a lock that is owned by a different owner.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class UnownedRefreshLockEvent extends BaseEvent<{
key: string;
owner: string;
}> {
}
/**
* The event is dispatched when trying to acquire a lock that is owned by a different owner.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class KeyAlreadyAcquiredLockEvent extends BaseEvent<{
key: string;
owner: string;
}> {
}
/**
* The event is dispatched when a lock is refreshed.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class KeyRefreshedLockEvent extends BaseEvent<{
key: string;
owner: string;
ttl: TimeSpan;
}> {
}
/**
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare class UnexpectedErrorLockEvent extends BaseEvent<{
key: string;
owner: string;
ttl: TimeSpan | null;
error: unknown;
}> {
}
/**
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare const LOCK_EVENTS: {
readonly KeyAcquired: typeof KeyAcquiredLockEvent;
readonly KeyReleased: typeof KeyReleasedLockEvent;
readonly UnownedRelease: typeof UnownedReleaseLockEvent;
readonly UnownedRefresh: typeof UnownedRefreshLockEvent;
readonly KeyAlreadyAcquired: typeof KeyAlreadyAcquiredLockEvent;
readonly KeyForceReleased: typeof KeyForceReleasedLockEvent;
readonly KeyRefreshed: typeof KeyRefreshedLockEvent;
readonly UnexpectedError: typeof UnexpectedErrorLockEvent;
};
/**
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export type LockEvents = KeyAcquiredLockEvent | KeyReleasedLockEvent | UnownedReleaseLockEvent | UnownedRefreshLockEvent | KeyAlreadyAcquiredLockEvent | KeyForceReleasedLockEvent | KeyRefreshedLockEvent | UnexpectedErrorLockEvent;
/**
* The `registerLockEventsToSerde` function registers all {@link ILock | `ILock`} related events with `IFlexibleSerde`, ensuring they will properly be serialized and deserialized.
*
* IMPORT_PATH: `"@daiso-tech/core/lock/contracts"`
* @group Events
*/
export declare function registerLockEventsToSerde(serde: OneOrMore<IFlexibleSerde>): void;