UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

35 lines • 1.94 kB
import type { S3Client } from '@aws-sdk/client-s3'; import type { S3Config } from '../../vfs/s3/config.ts'; import type { S3Module, S3SendClient } from './types.ts'; export declare function s3Key(path: string, config: S3Config): string; export declare function withClient<T>(config: S3Config, fn: (client: S3SendClient) => Promise<T>): Promise<T>; /** * Load the S3 "command module" (GetObjectCommand etc.). When `config` * has a presignedUrlProvider — the browser runtime path — skip the AWS * SDK entirely and return a set of tagged data-only shim classes that * the browser-side client knows how to dispatch via fetch(). * * Mirrors Python's `async_session(config)` abstraction: one seam, * two implementations (boto3 vs. presigner+fetch), same call surface. */ export declare function loadS3Module(config?: S3Config): Promise<S3Module>; export declare function createS3Client(config: S3Config): Promise<S3Client>; export declare function isNotFound(err: unknown): boolean; /** * Whether an S3 error means the key refuses this caller (403). Keyed on the * error's code; a bodiless reply (named Unknown) is judged on its status. A * HEAD carries no body, so a credential failure behind one reads as a * refusal, as does any 403 the browser client's presigned fetch answers. * Mirrors Python's `is_denied`. */ export declare function isDenied(err: unknown): boolean; /** * Whether a conditional request lost: the object changed since the version * sent (412), or another conditional write is in flight (409). Keyed on the * error's code, so any other 409 or 412, and auth, missing-key and transport * failures, keep their own meaning; a bodiless reply (named Unknown) is * judged on its status. Mirrors Python's `is_condition_lost`. */ export declare function isConditionLost(err: unknown): boolean; export declare function streamToBuffer(stream: unknown): Promise<Uint8Array>; //# sourceMappingURL=client.d.ts.map