Auth and Admin Services
The client exposes six service handles that are created in the
LioranDBClient constructor:
client.authclient.usersclient.rolesclient.clusterclient.backupsclient.settings
These are thin, source-backed wrappers over the server HTTP API.
AuthService
Public methods from the source:
login(username, password)refresh(refreshToken)logout()logoutAll()me()listSessions()revokeSession(sessionId)changePassword(newPassword, clearMustChange?)
login(username, password)
Authenticates and stores returned tokens in memory through the client’s
TokenManager.
Example:
liorandb login admin --password "your-password"
Equivalent driver example:
- TypeScript
- JavaScript
const login = await client.auth.login("admin", "your-password");
console.log(login.principal.username, login.session.session_id);
const login = await client.auth.login("admin", "your-password");
console.log(login.principal.username, login.session.session_id);
Representative output:
admin sess_01K2EXAMPLE
refresh(refreshToken)
Exchanges a refresh token for a fresh token pair.
logout()
Revokes the current session and clears in-memory authentication state.
logoutAll()
Revokes every session for the current user.
me()
Returns the current authenticated principal.
listSessions()
Returns readonly session views.
revokeSession(sessionId)
Revokes one session by id.
changePassword(newPassword, clearMustChange?)
Changes the current user’s password.
UsersService
Public methods:
list()create(input)get(userId)update(userId, input)delete(userId)resetPassword(userId, input)revokeSessions(userId)
create(input)
The input type is CreateUserInput:
interface CreateUserInput {
readonly username: string;
readonly password: string;
readonly roles?: readonly string[];
readonly must_change_password?: boolean;
}
Example:
- TypeScript
- JavaScript
const user = await client.users.create({
username: "ops-user",
password: "SuperStrongPassword123!",
roles: ["admin"],
must_change_password: true,
});
console.log(user.id, user.username, user.enabled);
const user = await client.users.create({
username: "ops-user",
password: "SuperStrongPassword123!",
roles: ["admin"],
must_change_password: true,
});
console.log(user.id, user.username, user.enabled);
Representative output:
user:ops-user ops-user true
RolesService
Public methods:
listPermissions()listRoles()createRole(input)getRole(roleId)updateRole(roleId, input)deleteRole(roleId)
listPermissions()
Returns the permission names advertised by the server.
createRole(input)
CreateRoleInput uses PermissionGrant[], and each grant has:
permissionscope
The source supports cluster, database, and collection scopes.
Example:
- TypeScript
- JavaScript
const role = await client.roles.createRole({
name: "readers",
grants: [
{
permission: "DocumentRead",
scope: {kind: "database", database: "default"},
},
],
});
console.log(role.name, role.grants.length);
const role = await client.roles.createRole({
name: "readers",
grants: [
{
permission: "DocumentRead",
scope: {kind: "database", database: "default"},
},
],
});
console.log(role.name, role.grants.length);
Representative output:
readers 1
ClusterService
Public methods:
summary()nodes()partitions()health()readiness()checkpoint()compact()
summary()
Returns cluster summary data.
nodes()
Returns readonly node config views.
partitions()
Returns readonly partition placement views.
health()
Returns readonly partition health snapshots.
readiness()
Returns the current readiness state and its transitions.
checkpoint()
Triggers a checkpoint operation.
compact()
Triggers compaction.
Example:
- TypeScript
- JavaScript
const summary = await client.cluster.summary();
console.log(summary.node_id, summary.partitions, summary.state);
const summary = await client.cluster.summary();
console.log(summary.node_id, summary.partitions, summary.state);
Representative output:
1 128 Ready
BackupsService
Public methods:
list()create(input?)get(backupId)delete(backupId)verify(backupId)restore(backupId, input)getRestoreJob(jobId)
create(input?)
Accepts:
interface BackupCreateInput {
readonly label?: string;
readonly scope?: "cluster" | "local_node";
}
restore(backupId, input)
Accepts:
interface RestoreInput {
readonly confirmation: string;
readonly disable_safety_backup?: boolean;
}
SettingsService
Public methods:
get()update(values)getCors()updateCors(settings)getPerformance()updatePerformance(settings)getLimits()updateLimits(settings)getBackups()updateBackups(settings)
get()
Returns the redacted generic settings map.
update(values)
Patches the generic settings map.
getCors() and updateCors(settings)
Read and replace CORS settings.
getPerformance() and updatePerformance(settings)
Read and replace performance controller settings.
getLimits() and updateLimits(settings)
Read and replace admission/quota settings.
getBackups() and updateBackups(settings)
Read and replace backup scheduling and retention settings.
Important note on response shapes
These services return the source-defined admin types, including:
UserRecordRoleRecordClusterSummaryBackupJobRecordRestoreJobRecordCorsSettingsPerformanceSettingsLimitSettingsBackupSettings
Those interfaces are exported by the package and documented further in the reference page.