Node.js client library for link-cli — implementation of Links Theory database.
Install link-cli globally:
dotnet tool install --global clinknpm install @link-foundation/links-clientOr use GitHub directly:
npm install git+https://github.com/link-foundation/links-client.gitimport { LinkDBService } from '@link-foundation/links-client';
const db = new LinkDBService('/path/to/database.links');
// Create a link
const link = await db.createLink(100, 200);
console.log(link); // { id: 1, source: 100, target: 200 }
// Read all links
const links = await db.readAllLinks();
// Delete a link
await db.deleteLink(1);import { MenuStorageService } from '@link-foundation/links-client';
const menuStorage = new MenuStorageService();
const menu = [
{
label: "Dashboard",
icon: "pi pi-home",
to: "/dashboard",
items: [
{ label: "Analytics", to: "/dashboard/analytics" }
]
}
];
await menuStorage.storeMenuStructure(menu, 0);
const retrievedMenu = await menuStorage.getMenuStructure(0);import { AuthStorageService } from '@link-foundation/links-client';
const authStorage = new AuthStorageService();
// Create user
const user = await authStorage.createUser({
username: "alice",
email: "alice@example.com"
});
// Set password
await authStorage.setPassword(user.userId, {
hash: "hashed_password",
salt: "random_salt"
});For detailed API documentation, see the docs/ directory.
See examples in the examples/ directory:
basic-usage.js- Basic clink integration testsmenu-storage.js- Menu storage demonstrationauth-storage.js- Authentication storage demonstrationintegration.js- Full integration example
Run tests with Node.js test runner:
npm testThe Unlicense
- Repository: https://github.com/link-foundation/links-client
- link-cli: https://github.com/link-foundation/link-cli