FluxbaseAdminRPC
Admin RPC manager for managing RPC procedures Provides sync, CRUD, and execution monitoring operations
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FluxbaseAdminRPC(
fetch):FluxbaseAdminRPC
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetch | FluxbaseFetch |
Returns
Section titled “Returns”FluxbaseAdminRPC
Methods
Section titled “Methods”cancelExecution()
Section titled “cancelExecution()”cancelExecution(
executionId):Promise<{data:RPCExecution|null;error:Error|null; }>
Cancel a running execution
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
executionId | string | Execution ID |
Returns
Section titled “Returns”Promise<{ data: RPCExecution | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated execution
Example
Section titled “Example”const { data, error } = await client.admin.rpc.cancelExecution('execution-uuid')delete()
Section titled “delete()”delete(
namespace,name):Promise<{data:null;error:Error|null; }>
Delete an RPC procedure
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace | string | Procedure namespace |
name | string | Procedure name |
Returns
Section titled “Returns”Promise<{ data: null; error: Error | null; }>
Promise resolving to { data, error } tuple
Example
Section titled “Example”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
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace | string | Procedure namespace |
name | string | Procedure name |
Returns
Section titled “Returns”Promise<{ data: RPCProcedure | null; error: Error | null; }>
Promise resolving to { data, error } tuple with procedure details
Example
Section titled “Example”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()
Section titled “getExecution()”getExecution(
executionId):Promise<{data:RPCExecution|null;error:Error|null; }>
Get details of a specific execution
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
executionId | string | Execution ID |
Returns
Section titled “Returns”Promise<{ data: RPCExecution | null; error: Error | null; }>
Promise resolving to { data, error } tuple with execution details
Example
Section titled “Example”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()
Section titled “getExecutionLogs()”getExecutionLogs(
executionId,afterLine?):Promise<{data:ExecutionLog[] |null;error:Error|null; }>
Get execution logs for a specific execution
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
executionId | string | Execution ID |
afterLine? | number | Optional line number to get logs after (for polling) |
Returns
Section titled “Returns”Promise<{ data: ExecutionLog[] | null; error: Error | null; }>
Promise resolving to { data, error } tuple with execution logs
Example
Section titled “Example”const { data, error } = await client.admin.rpc.getExecutionLogs('execution-uuid')if (data) { for (const log of data) { console.log(`[${log.level}] ${log.message}`) }}list()
Section titled “list()”list(
namespace?):Promise<{data:RPCProcedureSummary[] |null;error:Error|null; }>
List all RPC procedures (admin view)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace? | string | Optional namespace filter |
Returns
Section titled “Returns”Promise<{ data: RPCProcedureSummary[] | null; error: Error | null; }>
Promise resolving to { data, error } tuple with array of procedure summaries
Example
Section titled “Example”const { data, error } = await client.admin.rpc.list()if (data) { console.log('Procedures:', data.map(p => p.name))}listExecutions()
Section titled “listExecutions()”listExecutions(
filters?):Promise<{data:RPCExecution[] |null;error:Error|null; }>
List RPC executions with optional filters
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
filters? | RPCExecutionFilters | Optional filters for namespace, procedure, status, user |
Returns
Section titled “Returns”Promise<{ data: RPCExecution[] | null; error: Error | null; }>
Promise resolving to { data, error } tuple with array of executions
Example
Section titled “Example”// List all executionsconst { data, error } = await client.admin.rpc.listExecutions()
// List failed executions for a specific procedureconst { data, error } = await client.admin.rpc.listExecutions({ namespace: 'default', procedure: 'get-user-orders', status: 'failed',})listNamespaces()
Section titled “listNamespaces()”listNamespaces():
Promise<{data:string[] |null;error:Error|null; }>
List all namespaces
Returns
Section titled “Returns”Promise<{ data: string[] | null; error: Error | null; }>
Promise resolving to { data, error } tuple with array of namespace names
Example
Section titled “Example”const { data, error } = await client.admin.rpc.listNamespaces()if (data) { console.log('Namespaces:', data)}sync()
Section titled “sync()”sync(
options?):Promise<{data:SyncRPCResult|null;error:Error|null; }>
Sync RPC procedures from filesystem or API payload
Can sync from:
- Filesystem (if no procedures provided) - loads from configured procedures directory
- API payload (if procedures array provided) - syncs provided procedure specifications
Requires service_role or admin authentication.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? | SyncRPCOptions | Sync options including namespace and optional procedures array |
Returns
Section titled “Returns”Promise<{ data: SyncRPCResult | null; error: Error | null; }>
Promise resolving to { data, error } tuple with sync results
Example
Section titled “Example”// Sync from filesystemconst { data, error } = await client.admin.rpc.sync()
// Sync with provided procedure codeconst { 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()
Section titled “toggle()”toggle(
namespace,name,enabled):Promise<{data:RPCProcedure|null;error:Error|null; }>
Enable or disable an RPC procedure
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace | string | Procedure namespace |
name | string | Procedure name |
enabled | boolean | Whether to enable or disable |
Returns
Section titled “Returns”Promise<{ data: RPCProcedure | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated procedure
Example
Section titled “Example”const { data, error } = await client.admin.rpc.toggle('default', 'get-user-orders', true)update()
Section titled “update()”update(
namespace,name,updates):Promise<{data:RPCProcedure|null;error:Error|null; }>
Update an RPC procedure
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace | string | Procedure namespace |
name | string | Procedure name |
updates | UpdateRPCProcedureRequest | Fields to update |
Returns
Section titled “Returns”Promise<{ data: RPCProcedure | null; error: Error | null; }>
Promise resolving to { data, error } tuple with updated procedure
Example
Section titled “Example”const { data, error } = await client.admin.rpc.update('default', 'get-user-orders', { enabled: false, max_execution_time_seconds: 60,})