@oddlynew/distilled-neon
v0.26.3
Published
Effect-native Neon SDK generated from the [Neon OpenAPI specification](https://api-docs.neon.tech). Manage serverless Postgres projects, branches, endpoints, databases, and roles with exhaustive error typing.
Downloads
257
Readme
@oddlynew/distilled-neon
Effect-native Neon SDK generated from the Neon OpenAPI specification. Manage serverless Postgres projects, branches, endpoints, databases, and roles with exhaustive error typing.
Installation
npm install @oddlynew/distilled-neon effectQuick Start
import { Effect, Layer } from "effect";
import * as Stream from "effect/Stream";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import { listProjects } from "@oddlynew/distilled-neon/Operations";
import { CredentialsFromEnv } from "@oddlynew/distilled-neon";
const program = Effect.gen(function* () {
const projects = yield* listProjects({});
return projects.projects;
});
const NeonLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv);
program.pipe(Effect.provide(NeonLive), Effect.runPromise);Configuration
Set the following environment variable:
NEON_API_KEY=your-api-keyCreate an API key in the Neon console under Settings > API Keys.
Error Handling
import { getProject } from "@oddlynew/distilled-neon/Operations";
getProject({ project_id: "missing" }).pipe(
Effect.catchTags({
NotFound: () => Effect.succeed(null),
UnknownNeonError: (e) => Effect.fail(new Error(`Unknown: ${e.message}`)),
}),
);License
MIT
