UNPKG

@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.

49 lines (48 loc) 1.61 kB
/** * @module Lock */ import { type IEventListenable } from "../../event-bus/contracts/_module.js"; import { type ILock } from "../../lock/contracts/lock.contract.js"; import { type LockEventMap } from "../../lock/contracts/lock.events.js"; import { type ITimeSpan } from "../../time-span/contracts/_module.js"; /** * The `ILockListenable` contract defines a way for listening {@link ILock | `ILock`} operations. * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Contracts */ export type ILockListenable = IEventListenable<LockEventMap>; /** * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Contracts */ export type LockProviderCreateSettings = { /** * You can also provide a `settings.ttl` value using. If not specified it defaults to null, meaning no TTL is applied. */ ttl?: ITimeSpan | null; /** * You can provide a custom lock id. If not specified a unique lock id will be generated by default. */ lockId?: string; }; /** * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Contracts */ export type ILockProviderBase = { /** * The `create` method is used to create an instance of {@link ILock | `ILock`}. */ create(key: string, settings?: LockProviderCreateSettings): ILock; }; /** * The `ILockProvider` contract defines a way for managing locks independent of the underlying technology. * It commes with more convient methods compared to `ILockAdapter`. * * IMPORT_PATH: `"@daiso-tech/core/lock/contracts"` * @group Contracts */ export type ILockProvider = ILockListenable & ILockProviderBase;