import { type FetchLike } from "@render-lab/tasks-core"; import type { CreatePrivateServiceInput, CreateProjectInput, DeployDTO, KeyValueDTO, LogLineDTO, PostgresDTO, ProjectDTO, ProvisionKeyValueInput, ProvisionPostgresInput, ProvisionServiceInput, ScaleServiceInput, ServiceDTO, TriggerDeployInput } from "./types.js"; export type { FetchLike }; /** * The slice of the Render control-plane API the tasks need. Impls depend on this * port so they can be unit-tested with a fake; the default implementation is * `fetch`-backed. Every method returns a plain JSON DTO (ADR-0003) — never a raw * Render API object. * * `ensurePostgres` / `ensureKeyValue` / `ensurePrivateService` are **idempotent * by name**: they look the resource up first and create only when absent, so the * durable poll (which re-runs the whole task) never provisions a duplicate. */ export interface RenderPort { getService(serviceId: string): Promise; triggerDeploy(input: TriggerDeployInput): Promise; getDeploy(serviceId: string, deployId: string): Promise; scaleService(input: ScaleServiceInput): Promise<{ numInstances: number | null; plan: string | null; }>; setSuspended(serviceId: string, suspended: boolean): Promise; /** Find-or-create a Postgres by name, returning its current status. */ ensurePostgres(input: ProvisionPostgresInput): Promise; /** Find-or-create a Key Value by name, returning its current status. */ ensureKeyValue(input: ProvisionKeyValueInput): Promise; /** * Find-or-create a private service by name, returning it plus the id of the * deploy to await (the initial deploy on create, or the latest on find). */ ensurePrivateService(input: CreatePrivateServiceInput): Promise<{ service: ServiceDTO; deployId: string | null; }>; /** * Find-or-create-**or-reconcile** a service by name. On create, the deploy to * await is the initial one. On find, if the desired serviceDetails differ from * the live service (e.g. a repaired start/docker command), the settings are * PATCHed and a fresh deploy is triggered — so a re-provision after a blueprint * fix actually reaches the running service instead of redeploying the stale * command. When nothing changed, the latest deploy is awaited (no churn). */ ensureService(input: ProvisionServiceInput): Promise<{ service: ServiceDTO; deployId: string | null; created: boolean; }>; /** * Find-or-create a project by exact name (scoped to the owner), returning it * plus the id of its single environment. Idempotent so a retried deploy reuses * the same project rather than duplicating it. */ ensureProject(input: CreateProjectInput): Promise<{ project: ProjectDTO; environmentId: string; }>; deleteService(serviceId: string): Promise<{ alreadyMissing: boolean; }>; deletePostgres(postgresId: string): Promise<{ alreadyMissing: boolean; }>; deleteKeyValue(keyValueId: string): Promise<{ alreadyMissing: boolean; }>; deleteDisk(diskId: string): Promise<{ alreadyMissing: boolean; }>; deleteProject(projectId: string): Promise<{ alreadyMissing: boolean; }>; listLogs(input: { resourceIds: string[]; /** Workspace (owner) id — required by GET /v1/logs. */ ownerId: string; /** Lower-bound timestamp (ISO 8601); scopes results by recency. */ startTime?: string; maxBytes: number; maxLines: number; }): Promise<{ lines: LogLineDTO[]; truncated: boolean; nextStartTime: string | null; }>; } export interface RenderDeps { render: RenderPort; } /** * Default Render control-plane port backed by the REST API. * * `RENDER_API_KEY` is read lazily on first call (never at import) per ADR-0007; * `RENDER_OWNER_ID` supplies the default owner for the `provision*` / * `createPrivateService` creates and is overridable per input. A non-2xx throws * (via the shared client) so the durable task retry fires (ADR-0005). * * List endpoints return `[{ "": {...}, "cursor" }]`; create endpoints * return the object directly (services wrap it as `{ service, deployId }`). */ export declare function renderFetchPort(opts?: { fetchImpl?: FetchLike; env?: NodeJS.ProcessEnv; /** Injectable sleep for the in-process 429/5xx backoff (tests). */ sleep?: (ms: number) => Promise; /** Injectable jitter source for the backoff (tests). */ random?: () => number; }): RenderPort; /** Default deps used by the wrapped tasks in production. */ export declare const defaultDeps: RenderDeps; //# sourceMappingURL=client.d.ts.map