@kevinmichaelchen/distilled-opensearch
v0.3.0
Published
Effect 4-native OpenSearch REST API SDK generated from the official OpenAPI specification
Readme
distilled-opensearch
An Effect-native OpenSearch REST API SDK generated from the official OpenAPI 3.1 specification.
The SDK groups operations into service modules. Runtime schemas, protocol
traits, typed errors, retry support, and streaming pagination come from
@kevinmichaelchen/distilled; authentication and OpenSearch's HTTP behavior
are defined by this package.
Set OPENSEARCH_URL and either OPENSEARCH_USERNAME with
OPENSEARCH_PASSWORD, or OPENSEARCH_TOKEN. Authentication may be omitted for
a deliberately unsecured cluster.
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import {
CredentialsFromEnv,
Services,
} from "@kevinmichaelchen/distilled-opensearch";
const OpenSearchLive = Layer.mergeAll(
FetchHttpClient.layer,
CredentialsFromEnv,
);
const health = await Effect.runPromise(
Services.cluster.clusterHealth0({}).pipe(Effect.provide(OpenSearchLive)),
);Amazon OpenSearch Service signing belongs in the supplied HTTP client layer.
Run bun run generate after updating the pinned specification. Generated
service modules under src/services must not be edited by hand.
