Skip to content

FluxbaseAdminRPC

Admin RPC manager for managing RPC procedures Provides sync, CRUD, and execution monitoring operations

new FluxbaseAdminRPC(fetch): FluxbaseAdminRPC

ParameterType
fetchFluxbaseFetch

FluxbaseAdminRPC

cancelExecution(executionId): Promise<object>

Cancel a running execution

ParameterTypeDescription
executionIdstringExecution ID

Promise<object>

Promise resolving to { data, error } tuple with updated execution

NameType
datanull | RPCExecution
errornull | Error
const { data, error } = await client.admin.rpc.cancelExecution('execution-uuid')

delete(namespace, name): Promise<object>

Delete an RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name

Promise<object>

Promise resolving to { data, error } tuple

NameType
datanull
errornull | Error
const { data, error } = await client.admin.rpc.delete('default', 'get-user-orders')

get(namespace, name): Promise<object>

Get details of a specific RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name

Promise<object>

Promise resolving to { data, error } tuple with procedure details

NameType
datanull | RPCProcedure
errornull | Error
const { data, error } = await client.admin.rpc.get('default', 'get-user-orders')
if (data) {
console.log('Procedure:', data.name)
console.log('SQL:', data.sql_query)
}

getExecution(executionId): Promise<object>

Get details of a specific execution

ParameterTypeDescription
executionIdstringExecution ID

Promise<object>

Promise resolving to { data, error } tuple with execution details

NameType
datanull | RPCExecution
errornull | Error
const { data, error } = await client.admin.rpc.getExecution('execution-uuid')
if (data) {
console.log('Status:', data.status)
console.log('Duration:', data.duration_ms, 'ms')
}

getExecutionLogs(executionId, afterLine?): Promise<object>

Get execution logs for a specific execution

ParameterTypeDescription
executionIdstringExecution ID
afterLine?numberOptional line number to get logs after (for polling)

Promise<object>

Promise resolving to { data, error } tuple with execution logs

NameType
datanull | ExecutionLog[]
errornull | Error
const { data, error } = await client.admin.rpc.getExecutionLogs('execution-uuid')
if (data) {
for (const log of data) {
console.log(`[${log.level}] ${log.message}`)
}
}

list(namespace?): Promise<object>

List all RPC procedures (admin view)

ParameterTypeDescription
namespace?stringOptional namespace filter

Promise<object>

Promise resolving to { data, error } tuple with array of procedure summaries

NameType
datanull | RPCProcedureSummary[]
errornull | Error
const { data, error } = await client.admin.rpc.list()
if (data) {
console.log('Procedures:', data.map(p => p.name))
}

listExecutions(filters?): Promise<object>

List RPC executions with optional filters

ParameterTypeDescription
filters?RPCExecutionFiltersOptional filters for namespace, procedure, status, user

Promise<object>

Promise resolving to { data, error } tuple with array of executions

NameType
datanull | RPCExecution[]
errornull | Error
// List all executions
const { data, error } = await client.admin.rpc.listExecutions()
// List failed executions for a specific procedure
const { data, error } = await client.admin.rpc.listExecutions({
namespace: 'default',
procedure: 'get-user-orders',
status: 'failed',
})

listNamespaces(): Promise<object>

List all namespaces

Promise<object>

Promise resolving to { data, error } tuple with array of namespace names

NameType
datanull | string[]
errornull | Error
const { data, error } = await client.admin.rpc.listNamespaces()
if (data) {
console.log('Namespaces:', data)
}

sync(options?): Promise<object>

Sync RPC procedures from filesystem or API payload

Can sync from:

  1. Filesystem (if no procedures provided) - loads from configured procedures directory
  2. API payload (if procedures array provided) - syncs provided procedure specifications

Requires service_role or admin authentication.

ParameterTypeDescription
options?SyncRPCOptionsSync options including namespace and optional procedures array

Promise<object>

Promise resolving to { data, error } tuple with sync results

NameType
datanull | SyncRPCResult
errornull | Error
// Sync from filesystem
const { data, error } = await client.admin.rpc.sync()
// Sync with provided procedure code
const { data, error } = await client.admin.rpc.sync({
namespace: 'default',
procedures: [{
name: 'get-user-orders',
code: myProcedureSQL,
}],
options: {
delete_missing: false, // Don't remove procedures not in this sync
dry_run: false, // Preview changes without applying
}
})
if (data) {
console.log(`Synced: ${data.summary.created} created, ${data.summary.updated} updated`)
}

toggle(namespace, name, enabled): Promise<object>

Enable or disable an RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name
enabledbooleanWhether to enable or disable

Promise<object>

Promise resolving to { data, error } tuple with updated procedure

NameType
datanull | RPCProcedure
errornull | Error
const { data, error } = await client.admin.rpc.toggle('default', 'get-user-orders', true)

update(namespace, name, updates): Promise<object>

Update an RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name
updatesUpdateRPCProcedureRequestFields to update

Promise<object>

Promise resolving to { data, error } tuple with updated procedure

NameType
datanull | RPCProcedure
errornull | Error
const { data, error } = await client.admin.rpc.update('default', 'get-user-orders', {
enabled: false,
max_execution_time_seconds: 60,
})