@meshqljs/client
v0.8.6
Published
MeshQL typed client SDK
Readme
@meshql/client
Typed client SDK for MeshQL APIs.
Install
npm install @meshqljs/client
# or
npx jsr add @meshql/clientPublished on npm as @meshqljs/client and JSR as @meshql/client.
Browser
The client runs in modern browsers — it uses fetch, FormData, Blob, and
Web Crypto for signing and uploads. No Node Buffer or node:crypto required.
import { createAuthClient } from "@meshqljs/client";
const client = createAuthClient({ url: "/mesh", format: "json" });
await client.login({ email: "[email protected]", password: "demo" });
const posts = await client.query(
{
post: {
$select: { id: true, title: true },
$page: { first: 10 },
$orderBy: [{ field: "id", direction: "asc" }],
},
},
);Example
import { createClient } from "@meshqljs/client";
const client = createClient({ url: "http://localhost:3000/mesh" });
const user = await client.query({
user: {
$select: {
id: true,
email: true,
tokens: { $select: { accessToken: true } },
},
},
});
console.log(user.email);JSON is the default format and supports read controls. For selection-only QL:
const client = createClient({
url: "http://localhost:3000/mesh",
format: "ql",
});
await client.query({
user: { $select: { id: true, email: true } },
});JSR import: @meshql/client.
