FluxbaseAdminRPC
Admin RPC manager for managing RPC procedures Provides sync, CRUD, and execution monitoring operations
Constructors
Section titled “Constructors”new FluxbaseAdminRPC()
Section titled “new FluxbaseAdminRPC()”new FluxbaseAdminRPC(
fetch):FluxbaseAdminRPC
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetch | FluxbaseFetch |
Returns
Section titled “Returns”Methods
Section titled “Methods”cancelExecution()
Section titled “cancelExecution()”cancelExecution(
executionId):Promise<object>
Cancel a running execution
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
executionId | string | Execution ID |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with updated execution
| Name | Type |
|---|---|
data | null | RPCExecution |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.rpc.cancelExecution('execution-uuid')delete()
Section titled “delete()”delete(
namespace,name):Promise<object>
Delete an RPC procedure
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace | string | Procedure namespace |
name | string | Procedure name |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple
| Name | Type |
|---|---|
data | null |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.rpc.delete('default', 'get-user-orders')get(
namespace,name):Promise<object>
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<object>
Promise resolving to { data, error } tuple with procedure details
| Name | Type |
|---|---|
data | null | RPCProcedure |
error | null | Error |
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<object>
Get details of a specific execution
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
executionId | string | Execution ID |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with execution details
| Name | Type |
|---|---|
data | null | RPCExecution |
error | null | Error |
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<object>
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<object>
Promise resolving to { data, error } tuple with execution logs
| Name | Type |
|---|---|
data | null | ExecutionLog[] |
error | null | Error |
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<object>
List all RPC procedures (admin view)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace? | string | Optional namespace filter |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with array of procedure summaries
| Name | Type |
|---|---|
data | null | RPCProcedureSummary[] |
error | null | Error |
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<object>
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<object>
Promise resolving to { data, error } tuple with array of executions
| Name | Type |
|---|---|
data | null | RPCExecution[] |
error | null | Error |
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<object>
List all namespaces
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with array of namespace names
| Name | Type |
|---|---|
data | null | string[] |
error | null | Error |
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<object>
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<object>
Promise resolving to { data, error } tuple with sync results
| Name | Type |
|---|---|
data | null | SyncRPCResult |
error | null | Error |
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<object>
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<object>
Promise resolving to { data, error } tuple with updated procedure
| Name | Type |
|---|---|
data | null | RPCProcedure |
error | null | Error |
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<object>
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<object>
Promise resolving to { data, error } tuple with updated procedure
| Name | Type |
|---|---|
data | null | RPCProcedure |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.rpc.update('default', 'get-user-orders', { enabled: false, max_execution_time_seconds: 60,})