import type { S3Client } from "@aws-sdk/client-s3"; import type { Disk } from "disk"; import type { Adapter } from "../index.js"; export interface ArchilAdapterOptions { /** Archil S3 access key id. Falls back to `ARCHIL_S3_ACCESS_KEY_ID`. */ accessKeyId?: string; /** * The disk id to scope operations to — Archil's equivalent of a bucket. * Optional only when a `disk` instance is passed instead. */ bucket?: string; /** * Scope every operation to a branch of the disk instead of its main view. * Archil selects the branch via the bucket, so the entire unified surface — * `upload`, `download`, `list`, `url`, presigned uploads — transparently * reads and writes that branch. Omit for the disk's default branch. Must be * non-empty and contain no `/`. */ branch?: string; /** * Default expiry, in seconds, for presigned URLs from `url()` when * `publicBaseUrl` is not set. Defaults to 3600. */ defaultUrlExpiresIn?: number; /** * An Archil {@link Disk} (from the `disk` package). When provided, `bucket` * and `region` default to the instance's `id` and `region`, and it is * exposed at {@link ArchilAdapter.disk} — the door to Archil-native * operations (`exec`, `grep`, `appendObject`, `share`) that the S3 `raw` * client can't reach. Requires the optional `disk` peer dependency. */ disk?: Disk; /** * Origin used to build URLs from `url()`. When set, `url(key)` returns * `${publicBaseUrl}/${key}` unsigned; otherwise `url()` mints a SigV4 * presigned GetObject. */ publicBaseUrl?: string; /** * Archil region, e.g. `aws-us-east-1` or `gcp-us-central1`. Defaults to the * `disk` instance's region when one is passed, else falls back to * `ARCHIL_REGION`. Selects which Archil endpoint the adapter talks to. */ region?: string; /** Archil S3 secret access key. Falls back to `ARCHIL_S3_SECRET_ACCESS_KEY`. */ secretAccessKey?: string; } export type ArchilAdapter = Adapter & { /** The branch this adapter is scoped to, if any. */ readonly branch?: string; /** * The underlying Archil {@link Disk}, present only when the adapter was * constructed with a `disk` instance. The door to Archil-native operations * that aren't object storage — `exec`, `grep`, `mount`, `appendObject`, * `share` — which `raw` (the `S3Client`) can't reach: * `files.adapter.disk?.exec("ls -R /")`. */ readonly disk?: Disk; /** The disk id this adapter is scoped to (without any branch suffix). */ readonly diskId: string; }; /** * An Archil disk via its S3-compatible API. A thin wrapper around the `s3()` * adapter: the disk id is the path-style bucket, the endpoint is derived from * the Archil region, and SigV4 signs every request (so byte ranges, multipart, * presigned `url()`, and presigned `signedUploadUrl()` all work). Auto-loads * `ARCHIL_S3_ACCESS_KEY_ID` / `ARCHIL_S3_SECRET_ACCESS_KEY` / `ARCHIL_REGION`. * * Pass a `disk` instance (from the `disk` package) to infer `bucket`/`region` * and expose Archil-native operations at `adapter.disk`. Set `branch` to scope * the whole surface to a branch of the disk. */ export declare const archil: (opts: ArchilAdapterOptions) => ArchilAdapter; //# sourceMappingURL=index.d.ts.map