/** * Internal helpers shared between sources/list.ts and sources/get.ts. * * Two transports back the read surface: * - presigned-URL (HQ-59): when a vault client is supplied AND the entity is a * company vault (cmp_*), reads go through the vault `list`/`presign` * endpoints — the client never talks to S3 directly. This is the path every * company read should take going forward. * - direct S3 (legacy / personal): no vault client, or a personal vault * (prs_*, whose membership-less creds 403 the membership-gated presign * endpoints). Goes through `getS3Client`, whose factory hook lets tests * inject an in-memory stub without vi.mock. */ import { S3Client } from "@aws-sdk/client-s3"; import type { EntityContext } from "../types.js"; import { type PresignTransportClient } from "../object-io.js"; export declare function getS3Client(ctx: EntityContext): S3Client; /** Test hook: replace the S3 client factory. */ export declare function _setSourcesS3Factory(f: (ctx: EntityContext) => S3Client): void; /** Test hook: restore the default S3 client factory. */ export declare function _resetSourcesS3Factory(): void; export declare function streamToString(body: unknown): Promise; /** Common shape of every reader's options: an entity + an optional vault client. */ export interface ReaderTransportOpts { entity: EntityContext; /** * Presign-capable vault client. When supplied and the entity is a company * vault (cmp_*), reads use the presigned-URL transport instead of direct S3. */ vault?: PresignTransportClient; } /** Lightweight listed object (transport-agnostic). */ export interface ListedKey { key: string; size: number; lastModified: Date; } /** True when this read should use the presigned-URL transport. */ export declare function usePresign(opts: ReaderTransportOpts): boolean; /** * Read an object's UTF-8 text. Throws a `NoSuchKey`-named error when the object * is absent (both transports), so callers' existing not-found checks work * unchanged. */ export declare function readObjectText(opts: ReaderTransportOpts, key: string): Promise; /** Like {@link readObjectText} but returns null when the object is absent. */ export declare function tryReadObjectText(opts: ReaderTransportOpts, key: string): Promise; /** * List one page of objects under `prefix`. * * Under the presigned transport the vault `list` endpoint is ACL-filtered and * controls page size server-side, so `limit` is advisory — paginate via the * returned `nextToken` (the opaque vault cursor) until it is undefined. Under * direct S3, `limit` maps to `MaxKeys`. */ export declare function listObjects(opts: ReaderTransportOpts, prefix: string, page: { limit?: number; continuationToken?: string; }): Promise<{ contents: ListedKey[]; nextToken?: string; }>; //# sourceMappingURL=internals.d.ts.map