@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
31 lines • 1.54 kB
TypeScript
import type { S3Accessor } from '../../accessor/s3.ts';
import { type FileEvent, type JsonValue, type PathSpec } from '../../types.ts';
/**
* Map one S3 event notification record onto mount paths.
*
* The consumer owns the transport (S3 Event Notifications delivered to an SQS
* queue, an SNS topic or EventBridge) and passes each record of a
* notification's `Records` with its `eventName`. Nothing here runs a loop. A
* record names the bucket and the object key, URL-encoded with `+` for a
* space, and says whether the object was written or removed.
*
* S3 does not say whether a write made the object or replaced it, so a key the
* hook has mapped before is an UPDATE and any other is a CREATE, as the Box
* hook splits an upload. A key ending in `/` is a directory marker: writing
* one makes the directory, and removing one leaves whatever is below it, so
* that directory is UNKNOWN. In a versioned bucket a `Delete` names the one
* version it removed, and an older one may now be the object, so the key is
* UNKNOWN; a delete marker hides the object, which is a DELETE. A record for
* another bucket, or for a key outside the mount's `keyPrefix`, maps to
* nothing.
*
* Mirrors Python `S3EventHook` (`core/s3/events.py`).
*/
export declare class S3EventHook {
private readonly accessor;
private readonly seen;
constructor(accessor: S3Accessor);
toEvents(root: PathSpec, eventName: string, payload: JsonValue): Promise<readonly FileEvent[]>;
private map;
}
//# sourceMappingURL=events.d.ts.map