import * as Layer from "effect/Layer"; import * as Redacted from "effect/Redacted"; import { CredentialsStore } from "../Auth/Credentials.ts"; /** * Canonical name registered in {@link AuthProviders}. Use this key to look * up the PlanetScale {@link AuthProvider} from inside provider Layers. */ export declare const PLANETSCALE_AUTH_PROVIDER_NAME = "Planetscale"; /** * Auth configuration persisted in `~/.alchemy/profiles.json` for the * PlanetScale provider. * * - `env`: read credentials from environment variables at resolution time. * - `stored`: read service-token credentials from * `~/.alchemy/credentials//planetscale-stored.json`. * - `oauth`: browser-based login; the access/refresh tokens are stored at * `~/.alchemy/credentials//planetscale-oauth.json` and refreshed * on demand. PlanetScale has no PKCE flow, so the OAuth application's * `client_secret` ships in the CLI — see {@link OAuthClient}. */ export type PlanetscaleAuthConfig = { method: "env"; } | { method: "stored"; } | { method: "oauth"; organization: string; }; /** * apiToken credentials persisted to disk for `method: "stored"`. * Stored under the file key `"planetscale-stored"`. */ export interface PlanetscaleStoredCredentials { type: "apiToken"; tokenId: string; token: string; organization: string; } /** * Resolved in-memory PlanetScale credentials returned by * {@link AuthProviderImpl.read}. Either a service token (`tokenId`/`token`) * or an OAuth access token. */ export type PlanetscaleResolvedCredentials = { type: "apiToken"; tokenId: Redacted.Redacted; token: Redacted.Redacted; organization: string; source: { type: PlanetscaleAuthConfig["method"]; details?: string; }; } | { type: "oauth"; accessToken: Redacted.Redacted; expires: number; organization: string; source: { type: PlanetscaleAuthConfig["method"]; details?: string; }; }; /** * Layer that registers the PlanetScale {@link AuthProvider} into the * {@link AuthProviders} registry when built. Include this in the * PlanetScale `providers()` layer so `alchemy login` can discover it. * * Supported methods: * - `env`: reads `PLANETSCALE_API_TOKEN_ID`/`PLANETSCALE_API_TOKEN`/`PLANETSCALE_ORGANIZATION`. * - `stored`: prompts for a service token interactively and writes it to * `~/.alchemy/credentials//planetscale-stored.json`. * - `oauth`: browser-based login storing access/refresh tokens at * `~/.alchemy/credentials//planetscale-oauth.json`. */ export declare const PlanetscaleAuth: Layer.Layer; //# sourceMappingURL=AuthProvider.d.ts.map