import { DeploymentTarget, DeployAdapter, DeploymentResult, AdapterHealth } from '@geenius/adapters'; /** * Supported deployment provider identifiers for the SDK-free deploy contract. * Use this when a downstream adapter slice needs to bind a generic deployment * target to one concrete platform without importing that platform's SDK. * * @example * ```ts * const provider: DeployProvider = "cloudflare"; * ``` */ type DeployProvider = DeploymentTarget["provider"]; /** * Deployment target narrowed to the provider handled by one adapter slice. * Use this in provider-specific code after validating unknown input with * {@link validateProviderDeploymentTarget}. * * @example * ```ts * const target: ProviderDeploymentTarget<"vercel"> = validateProviderDeploymentTarget("vercel", input); * ``` */ type ProviderDeploymentTarget = DeploymentTarget & { readonly provider: Provider; }; /** * Deploy adapter shape after the generic target has been narrowed to a single * provider. Use this as the public return type for provider slices so callers * cannot accidentally pass a target for a different platform. * * @example * ```ts * const adapter: ProviderDeployAdapter<"netlify"> = createProviderDeployAdapter({ provider: "netlify", adapter: base }); * ``` */ interface ProviderDeployAdapter extends Omit { /** * Deploys a target that has already been narrowed to this adapter's provider. * * @param target - Deployment target whose provider matches the slice. * @returns Provider-validated deployment metadata. * @example * ```ts * await adapter.deploy({ id: "site", provider: "cloudflare", projectName: "site" }); * ``` */ deploy(target: ProviderDeploymentTarget): Promise; } /** * Static metadata exported by provider slices without importing vendor SDKs. * Use this for provider pickers, docs tables, and conformance fixtures that * need to describe capabilities before runtime wiring is installed. * * @example * ```ts * const manifest: DeployProviderManifest<"heroku"> = { * provider: "heroku", * displayName: "Heroku", * runtime: "sdk-free-contract", * capabilities: ["deploy", "rollback"], * environmentVariables: ["HEROKU_API_KEY"], * }; * ``` */ interface DeployProviderManifest { readonly provider: Provider; readonly displayName: string; readonly runtime: "sdk-free-contract"; readonly capabilities: readonly string[]; readonly environmentVariables: readonly string[]; } /** * Input used to bind a generic deploy adapter to one provider-specific slice. * Use this with {@link createProviderDeployAdapter} when downstream code owns * the concrete runtime adapter but this package owns the validation boundary. * * @example * ```ts * const input: ProviderDeployAdapterInput<"cloudflare"> = { * provider: "cloudflare", * adapter: baseDeployAdapter, * }; * ``` */ interface ProviderDeployAdapterInput { readonly provider: Provider; readonly adapter: DeployAdapter; } interface ProviderDeploymentResultValidation { readonly deploymentId?: string; readonly targetId?: string; } /** * Checks whether unknown input is a deployment target for one provider. * Use this as a lightweight type guard before rendering provider-specific UI * or choosing a provider-bound adapter. * * @param provider - Provider identifier expected by the current slice. * @param target - Unknown value to validate against the deployment target schema. * @returns `true` when the value is a valid target for the requested provider. * @example * ```ts * if (isProviderDeploymentTarget("netlify", input)) { * await netlifyAdapter.deploy(input); * } * ``` */ declare function isProviderDeploymentTarget(provider: Provider, target: unknown): target is ProviderDeploymentTarget; /** * Parses unknown deployment input and enforces that it belongs to one provider. * Use this at provider-slice boundaries before calling any concrete platform * implementation. * * @param provider - Provider identifier accepted by the adapter slice. * @param target - Unknown deployment target payload from a caller or fixture. * @returns A deployment target narrowed to the requested provider. * @throws DeployContractError when the payload is invalid or targets another provider. * @example * ```ts * const target = validateProviderDeploymentTarget("cloudflare", payload); * await cloudflareRuntime.deploy(target); * ``` */ declare function validateProviderDeploymentTarget(provider: Provider, target: unknown): ProviderDeploymentTarget; /** * Validates deployment metadata returned by a provider implementation and, when * requested, checks that it matches the caller's deployment or target id. Use * this after deploy, rollback, lookup, and list operations to keep provider * slices aligned with the root contract. * * @param result - Deployment result returned by a concrete provider adapter. * @param validation - Optional id checks tied to the request being fulfilled. * @returns A schema-validated deployment result. * @throws DeployContractError when the result shape or requested ids do not match. * @example * ```ts * return validateProviderDeploymentResult(result, { targetId: target.id }); * ``` */ declare function validateProviderDeploymentResult(result: DeploymentResult, validation?: ProviderDeploymentResultValidation): DeploymentResult; /** * Validates health payloads returned from provider-bound deploy adapters. * Use this before exposing provider health in review apps or operational * dashboards so malformed platform responses stay behind the contract layer. * * @param health - Health object returned by a provider implementation. * @returns A schema-validated health record. * @throws DeployContractError when health metadata does not match the contract. * @example * ```ts * const health = validateProviderAdapterHealth(await adapter.getHealth()); * ``` */ declare function validateProviderAdapterHealth(health: AdapterHealth): AdapterHealth; /** * Wraps a generic deploy adapter with provider-specific input and output * validation. Use this in downstream provider slices when the concrete runtime * adapter is supplied by an app or package that owns the vendor SDK. * * @param input - Provider identifier and generic deploy adapter to bind. * @returns A deploy adapter that only accepts targets for the requested provider. * @throws DeployContractError when the adapter is incomplete or returns invalid payloads. * @example * ```ts * export const cloudflareDeploy = createProviderDeployAdapter({ * provider: "cloudflare", * adapter: cloudflareRuntimeAdapter, * }); * ``` */ declare function createProviderDeployAdapter({ provider, adapter, }: ProviderDeployAdapterInput): ProviderDeployAdapter; export { type DeployProvider as D, type ProviderDeployAdapter as P, type DeployProviderManifest as a, type ProviderDeployAdapterInput as b, type ProviderDeploymentTarget as c, createProviderDeployAdapter as d, validateProviderDeploymentResult as e, validateProviderDeploymentTarget as f, isProviderDeploymentTarget as i, validateProviderAdapterHealth as v };