@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.
37 lines (36 loc) • 1.15 kB
TypeScript
/**
* @module FileStorage
*/
import { type IEventListenable } from "../../event-bus/contracts/_module.js";
import { type IFile } from "../../file-storage/contracts/file.contract.js";
import { type FileEventMap } from "../../file-storage/contracts/file.events.js";
/**
* IMPORT_PATH: `"@daiso-tech/core/file-storage/contracts"`
* @group Contracts
*/
export type IFileListenable = IEventListenable<FileEventMap>;
/**
* IMPORT_PATH: `"@daiso-tech/core/file-storage/contracts"`
* @group Contracts
*/
export type IFileFactory = {
create(key: string): IFile;
};
/**
* IMPORT_PATH: `"@daiso-tech/core/file-storage/contracts"`
* @group Contracts
*/
export type IFileStorageBase = IFileFactory & {
clear(): Promise<void>;
removeMany(files: Iterable<IFile>): Promise<boolean>;
};
/**
* The `IFileStorage` contract defines a way for managing files independent of the underlying technology.
* It commes with more convient methods compared to `IFileStorageAdapter`.
*
* IMPORT_PATH: `"@daiso-tech/core/file-storage/contracts"`
* @group Contracts
*/
export type IFileStorage = IFileStorageBase & {
readonly events: IFileListenable;
};