import type { OAuthToken, WebDAVClient } from "webdav"; import type { Adapter } from "../index.js"; import { FilesError } from "../internal/errors.js"; /** * Named auth strategy. `"basic"` is an alias for `"password"`. Maps onto the * `webdav` library's `AuthType`. Defaults: `"token"` when a `token` is passed, * `"password"` when a `username` is passed, otherwise `"none"`. */ export type WebdavAuthType = "auto" | "basic" | "digest" | "none" | "password" | "token"; export interface WebdavAdapterOptions { /** * WebDAV server base URL — the collection virtual keys resolve under (e.g. * `https://dav.example.com/remote.php/dav/files/alice`). Falls back to * `WEBDAV_URL` (alias `WEBDAV_BASE_URL`). */ baseUrl?: string; /** Username for basic/digest auth. Falls back to `WEBDAV_USERNAME` (alias `WEBDAV_USER`). */ username?: string; /** Password for basic/digest auth. Falls back to `WEBDAV_PASSWORD`. */ password?: string; /** * Auth strategy. Inferred when omitted (see {@link WebdavAuthType}). Falls * back to `WEBDAV_AUTH_TYPE`. */ authType?: WebdavAuthType; /** OAuth token for `authType: "token"`. */ token?: OAuthToken; /** Extra headers sent on every request (e.g. a custom auth header). */ headers?: Record; /** * Remote base directory. Virtual keys resolve under it; keys that escape it * (e.g. `../secret`) throw `Provider`. Defaults to `"/"` (the collection the * `baseUrl` points at). */ root?: string; /** * Origin used to build URLs from `url()`. When set, `url(key)` returns * `${publicBaseUrl}/${key}`. When unset, `url()` throws: a WebDAV `GET` * needs auth, so there's no unauthenticated URL to hand out, and the * protocol has no signing primitive. */ publicBaseUrl?: string; /** * Pre-configured `webdav` client. When passed, the adapter reuses it and * ignores the connection options above — the caller owns its configuration. */ client?: WebDAVClient; } export type WebdavRaw = WebDAVClient; export type WebdavAdapter = Adapter & { readonly root: string; }; export declare const mapWebdavError: (err: unknown) => FilesError; export declare const webdav: (opts?: WebdavAdapterOptions) => WebdavAdapter; //# sourceMappingURL=index.d.ts.map