@hypelabs-llc/ts-sdk
v0.3.5
Published
The TypeScript client for the HypeLabs Connect API, for internal services.
Readme
Requirements
- Node.js 18 or later
- A HypeLabs Connect API key (
hl_live_…)
The client authenticates with an API key, so run it server-side (Node, a backend, or a framework's server runtime) — never ship your key to the browser.
Install
Add the package:
pnpm add @hypelabs-llc/ts-sdkCreate your organization on the HypeLabs Console and generate an API key.
Usage
Create a client with your API key and call the API. Every call is async and returns typed models.
import { createConnectClient } from "@hypelabs-llc/ts-sdk";
const client = createConnectClient(process.env.CONNECT_API_KEY!);
const products = await client.products.get();
for (const product of products ?? []) {
console.log(product.name, product.id);
}With Next.js
Keep one shared client in a server-only module so the key never reaches the browser:
// lib/connect.ts
import "server-only";
import { createConnectClient } from "@hypelabs-llc/ts-sdk";
export const connect = createConnectClient(process.env.CONNECT_API_KEY!);// app/products/page.tsx — a Server Component
import { connect } from "@/lib/connect";
export default async function Page() {
const products = await connect.products.get();
return <pre>{JSON.stringify(products, null, 2)}</pre>;
}The API is authenticated with the X-Api-Key header, wired up internally — you never touch the Kiota plumbing.
