import type { Context } from "../context.js"; import { Resource } from "../resource.js"; import type { Secret } from "../secret.js"; import { type NeonApiOptions } from "./api.js"; /** * A Neon region where projects can be provisioned */ export type NeonRegion = "aws-us-east-1" | "aws-us-east-2" | "aws-us-west-2" | "aws-eu-central-1" | "aws-eu-west-2" | "aws-ap-southeast-1" | "aws-ap-southeast-2" | "aws-sa-east-1" | "azure-eastus2" | "azure-westus3" | "azure-gwc"; /** * Properties for creating or updating a Neon project */ export interface NeonProjectProps extends NeonApiOptions { /** * Name of the project */ name: string; /** * Region where the project will be provisioned * @default "aws-us-east-1" */ region_id?: NeonRegion; /** * PostgreSQL version to use * @default 15 */ pg_version?: 14 | 15 | 16; /** * Whether to create a default branch and endpoint * @default true */ default_endpoint?: boolean; /** * Default branch name * @default "main" */ default_branch_name?: string; /** * Existing project ID to update * Used internally during update operations * @internal */ existing_project_id?: string; } /** * A Neon database */ export interface NeonDatabase { /** * Database ID */ id: number; /** * ID of the branch this database belongs to */ branch_id: string; /** * Database name */ name: string; /** * Name of the database owner role */ owner_name: string; /** * Time at which the database was created */ created_at: string; /** * Time at which the database was last updated */ updated_at: string; } /** * A Neon database role */ export interface NeonRole { /** * ID of the branch this role belongs to */ branch_id: string; /** * Role name */ name: string; /** * Role password (only included during creation) */ password?: string; /** * Whether this role is protected from deletion */ protected: boolean; /** * Time at which the role was created */ created_at: string; /** * Time at which the role was last updated */ updated_at: string; } /** * A Neon branch */ export interface NeonBranch { /** * Branch ID */ id: string; /** * ID of the project this branch belongs to */ project_id: string; /** * Branch name */ name: string; /** * Current state of the branch */ current_state: string; /** * Pending state of the branch */ pending_state: string; /** * Time at which the branch was created */ created_at: string; /** * Time at which the branch was last updated */ updated_at: string; } /** * A Neon compute endpoint */ export interface NeonEndpoint { /** * Endpoint ID */ id: string; /** * Host for connecting to this endpoint */ host: string; /** * ID of the project this endpoint belongs to */ project_id: string; /** * ID of the branch this endpoint belongs to */ branch_id: string; /** * Endpoint type (read_write, read_only) */ type: string; /** * Current state of the endpoint */ current_state: string; /** * Pending state of the endpoint */ pending_state: string; /** * Region ID where this endpoint is provisioned */ region_id: string; /** * Minimum compute units for autoscaling */ autoscaling_limit_min_cu: number; /** * Maximum compute units for autoscaling */ autoscaling_limit_max_cu: number; /** * Whether connection pooler is enabled */ pooler_enabled: boolean; /** * Connection pooler mode */ pooler_mode: string; /** * Whether this endpoint is disabled */ disabled: boolean; /** * Whether passwordless access is enabled */ passwordless_access: boolean; /** * Time at which the endpoint was created */ created_at: string; /** * Time at which the endpoint was last updated */ updated_at: string; /** * Proxy host for this endpoint */ proxy_host: string; /** * Endpoint settings */ settings: { /** * PostgreSQL settings */ pg_settings: Record; }; } /** * A Neon connection URI */ export interface NeonConnectionUri { /** * Connection URI string */ connection_uri: Secret; /** * Connection parameters */ connection_parameters: { database: string; host: string; port: number; user: string; password: Secret; }; } /** * A Neon operation */ export interface NeonOperation { /** * Operation ID */ id: string; /** * ID of the project this operation belongs to */ project_id: string; /** * ID of the branch this operation affects, if applicable */ branch_id?: string; /** * ID of the endpoint this operation affects, if applicable */ endpoint_id?: string; /** * Action being performed */ action: string; /** * Current status of the operation */ status: string; /** * Number of failures encountered */ failures_count: number; /** * Time at which the operation was created */ created_at: string; /** * Time at which the operation was last updated */ updated_at: string; } /** * Output returned after Neon project creation/update * IMPORTANT: The interface name MUST match the exported resource name */ export interface NeonProject extends Resource<"neon::Project">, Omit { /** * The ID of the project */ id: string; /** * Time at which the project was created */ created_at: string; /** * Time at which the project was last updated */ updated_at: string; /** * Hostname for proxy access */ proxy_host?: string; /** * Connection URIs for the databases */ connection_uris: [NeonConnectionUri, ...NeonConnectionUri[]]; /** * Database roles created with the project */ roles: [NeonRole, ...NeonRole[]]; /** * Databases created with the project */ databases?: [NeonDatabase, ...NeonDatabase[]]; /** * Default branch information */ branch?: NeonBranch; /** * Compute endpoints for the project */ endpoints: [NeonEndpoint, ...NeonEndpoint[]]; } /** * Creates a Neon serverless PostgreSQL project. * * @example * // Create a basic Neon project with default settings: * const project = await NeonProject("my-project", { * name: "My Project" * }); * * @example * // Create a Neon project in a specific region with a specific PostgreSQL version: * const euProject = await NeonProject("my-eu-project", { * name: "My EU Project", * region_id: "aws-eu-west-1", * pg_version: 16, * apiKey: alchemy.secret(process.env.NEON_API_KEY) * }); * * @example * // Create a Neon project with a custom default branch name: * const devProject = await NeonProject("dev-project", { * name: "Development Project", * default_branch_name: "development" * }); */ export declare const NeonProject: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context, id: string, props: NeonProjectProps) => Promise); //# sourceMappingURL=project.d.ts.map