meshql-core
v0.7.1
Published
MeshQL core - parse queries, build join plans, shape responses
Downloads
2,232
Readme
@meshql/core
Parser, planner, shaper, and executor for client-driven field selection over REST.
Install
npm install meshql-core
# or
npx jsr add @meshql/corePublished on npm as meshql-core and JSR as @meshql/core.
Example
import { buildSelectSql, createMesh } from "meshql-core";
const mesh = createMesh({
entities: {
user: {
table: "users",
joins: { tokens: { table: "tokens", on: "user_id" } },
},
},
});
mesh.resolve("user", async (plan) => {
const sql = buildSelectSql(plan, mesh.schema);
return db.query(sql.text, sql.params);
});
const user = await mesh.execute("user { id email tokens { accessToken } }", {
context: { requestId: "req-1", method: "GET" },
});JSR import: @meshql/core.
