From TypeScript
@relatude/sdk is the client: a channel to the API's routes, a TokenSession that signs in and
keeps the token fresh, and RelatudeStore, which has the NodeStore's methods and a query builder
typed by your model's interfaces. The CMS interface is built on it, and a plugin gets the same store
as cms.store. Chapter 19 covers the SDK, and
chapter 20 the plugins.
import { db } from '@relatude/sdk';
interface IProduct { Name: string; Price: db.Decimal; }
const Product = db.nodeType<IProduct>('IProduct');
const session = new db.TokenSession('/relatude.cms/api');
await session.signIn(userName, password); // checked by VerifyLogin
const store = db.createStore({ baseUrl: '/relatude.cms/api', token: () => session.token() });
const cheap = await store.query(Product).where(n => n.Price.lte(500)).orderBy(n => n.Name).execute();