Files
smartbucket/ts/interfaces.ts

68 lines
1.7 KiB
TypeScript

import type { Directory } from "./classes.directory.js";
export interface IPathDecriptor {
path?: string;
directory?: Directory;
}
// ================================
// Bucket Watcher Interfaces
// ================================
/**
* Internal state tracking for a storage object
*/
export interface IStorageObjectState {
key: string;
etag: string;
size: number;
lastModified: Date;
}
/**
* Change event emitted by BucketWatcher
*/
export interface IStorageChangeEvent {
type: 'add' | 'modify' | 'delete';
key: string;
size?: number;
etag?: string;
lastModified?: Date;
bucket: string;
}
/**
* Watcher mode - 'poll' is the default, 'websocket' reserved for future implementation
*/
export type TBucketWatcherMode = 'poll' | 'websocket';
/**
* Options for creating a BucketWatcher
*/
export interface IBucketWatcherOptions {
/** Watcher mode: 'poll' (default) or 'websocket' (future) */
mode?: TBucketWatcherMode;
/** Prefix to filter objects (default: '' for all objects) */
prefix?: string;
/** Polling interval in milliseconds (default: 5000, poll mode only) */
pollIntervalMs?: number;
/** Optional RxJS buffering time in milliseconds */
bufferTimeMs?: number;
/** Emit initial state as 'add' events (default: false) */
includeInitial?: boolean;
/** Page size for listing operations (default: 1000) */
pageSize?: number;
// Future websocket options will be added here
// websocketUrl?: string;
}
// ================================
// Deprecated aliases
// ================================
/** @deprecated Use IStorageObjectState instead */
export type IS3ObjectState = IStorageObjectState;
/** @deprecated Use IStorageChangeEvent instead */
export type IS3ChangeEvent = IStorageChangeEvent;