Transport client for Lens API framework
npm install @sylphx/lens-clientType-safe client for the Lens API framework with real-time subscriptions.
``bash`
bun add @sylphx/lens-client
`typescript
import { createClient, WebSocketTransport } from "@sylphx/lens-client";
import type { AppRouter } from "./server";
const client = createClient
transport: new WebSocketTransport("ws://localhost:3000"),
});
// Query
const user = await client.user.get({ id: "1" });
// Mutation
const result = await client.user.create({ name: "John", email: "john@example.com" });
// Subscription
client.user.get({ id: "1" }).subscribe((user) => {
console.log("User updated:", user);
});
``
MIT
---
Built with @sylphx/lens-core, @sylphx/lens-server, and @sylphx/reify.
✨ Powered by Sylphx