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<{ data: RPCExecution | null; error: Error | null; }>

Cancel a running execution

ParameterTypeDescription
executionIdstringExecution ID

Promise<{ data: RPCExecution | null; error: Error | null; }>

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

const { data, error } = await client.admin.rpc.cancelExecution('execution-uuid')

delete(namespace, name): Promise<{ data: null; error: Error | null; }>

Delete an RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name

Promise<{ data: null; error: Error | null; }>

Promise resolving to { data, error } tuple

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

get(namespace, name): Promise<{ data: RPCProcedure | null; error: Error | null; }>

Get details of a specific RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name

Promise<{ data: RPCProcedure | null; error: Error | null; }>

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

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<{ data: RPCExecution | null; error: Error | null; }>

Get details of a specific execution

ParameterTypeDescription
executionIdstringExecution ID

Promise<{ data: RPCExecution | null; error: Error | null; }>

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

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<{ data: ExecutionLog[] | null; error: Error | null; }>

Get execution logs for a specific execution

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

Promise<{ data: ExecutionLog[] | null; error: Error | null; }>

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

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<{ data: RPCProcedureSummary[] | null; error: Error | null; }>

List all RPC procedures (admin view)

ParameterTypeDescription
namespace?stringOptional namespace filter

Promise<{ data: RPCProcedureSummary[] | null; error: Error | null; }>

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

const { data, error } = await client.admin.rpc.list()
if (data) {
console.log('Procedures:', data.map(p => p.name))
}

listExecutions(filters?): Promise<{ data: RPCExecution[] | null; error: Error | null; }>

List RPC executions with optional filters

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

Promise<{ data: RPCExecution[] | null; error: Error | null; }>

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

// 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<{ data: string[] | null; error: Error | null; }>

List all namespaces

Promise<{ data: string[] | null; error: Error | null; }>

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

const { data, error } = await client.admin.rpc.listNamespaces()
if (data) {
console.log('Namespaces:', data)
}

sync(options?): Promise<{ data: SyncRPCResult | null; error: Error | null; }>

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<{ data: SyncRPCResult | null; error: Error | null; }>

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

// 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<{ data: RPCProcedure | null; error: Error | null; }>

Enable or disable an RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name
enabledbooleanWhether to enable or disable

Promise<{ data: RPCProcedure | null; error: Error | null; }>

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

const { data, error } = await client.admin.rpc.toggle('default', 'get-user-orders', true)

update(namespace, name, updates): Promise<{ data: RPCProcedure | null; error: Error | null; }>

Update an RPC procedure

ParameterTypeDescription
namespacestringProcedure namespace
namestringProcedure name
updatesUpdateRPCProcedureRequestFields to update

Promise<{ data: RPCProcedure | null; error: Error | null; }>

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

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