FluxbaseAdminFunctions
Admin Functions manager for managing edge functions Provides create, update, delete, and bulk sync operations
Constructors
Section titled “Constructors”new FluxbaseAdminFunctions()
Section titled “new FluxbaseAdminFunctions()”new FluxbaseAdminFunctions(
fetch):FluxbaseAdminFunctions
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fetch | FluxbaseFetch |
Returns
Section titled “Returns”Methods
Section titled “Methods”create()
Section titled “create()”create(
request):Promise<object>
Create a new edge function
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
request | CreateFunctionRequest | Function configuration and code |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with created function metadata
| Name | Type |
|---|---|
data | null | EdgeFunction |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.functions.create({ name: 'my-function', code: 'export default async function handler(req) { return { hello: "world" } }', enabled: true})delete()
Section titled “delete()”delete(
name):Promise<object>
Delete an edge function
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name | string | Function 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.functions.delete('my-function')get(
name):Promise<object>
Get details of a specific edge function
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name | string | Function name |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with function metadata
| Name | Type |
|---|---|
data | null | EdgeFunction |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.functions.get('my-function')if (data) { console.log('Function version:', data.version)}getExecutions()
Section titled “getExecutions()”getExecutions(
name,limit?):Promise<object>
Get execution history for an edge function
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name | string | Function name |
limit? | number | Maximum number of executions to return (optional) |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with execution records
| Name | Type |
|---|---|
data | null | EdgeFunctionExecution[] |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.functions.getExecutions('my-function', 10)if (data) { data.forEach(exec => { console.log(`${exec.executed_at}: ${exec.status} (${exec.duration_ms}ms)`) })}list()
Section titled “list()”list(
namespace?):Promise<object>
List all edge functions (admin view)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
namespace? | string | Optional namespace filter (if not provided, lists all public functions) |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with array of functions
| Name | Type |
|---|---|
data | null | EdgeFunction[] |
error | null | Error |
Example
Section titled “Example”// List all public functionsconst { data, error } = await client.admin.functions.list()
// List functions in a specific namespaceconst { data, error } = await client.admin.functions.list('my-namespace')if (data) { console.log('Functions:', data.map(f => f.name))}listNamespaces()
Section titled “listNamespaces()”listNamespaces():
Promise<object>
List all namespaces that have edge functions
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with array of namespace strings
| Name | Type |
|---|---|
data | null | string[] |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.functions.listNamespaces()if (data) { console.log('Available namespaces:', data)}sync()
Section titled “sync()”sync(
options):Promise<object>
Sync multiple functions to a namespace
Bulk create/update/delete functions in a specific namespace. This is useful for deploying functions from your application to Fluxbase in Kubernetes or other container environments.
Requires service_role or admin authentication.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | SyncFunctionsOptions | Sync configuration including namespace, functions, and options |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with sync results
| Name | Type |
|---|---|
data | null | SyncFunctionsResult |
error | null | Error |
Example
Section titled “Example”// Sync functions to "payment-service" namespaceconst { data, error } = await client.admin.functions.sync({ namespace: 'payment-service', functions: [ { name: 'process-payment', code: 'export default async function handler(req) { ... }', enabled: true, allow_net: true }, { name: 'refund-payment', code: 'export default async function handler(req) { ... }', enabled: true } ], options: { delete_missing: true // Remove functions not in this list }})
if (data) { console.log(`Synced: ${data.summary.created} created, ${data.summary.updated} updated`)}
// Dry run to preview changesconst { data, error } = await client.admin.functions.sync({ namespace: 'myapp', functions: [...], options: { dry_run: true }})update()
Section titled “update()”update(
name,updates):Promise<object>
Update an existing edge function
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
name | string | Function name |
updates | UpdateFunctionRequest | Fields to update |
Returns
Section titled “Returns”Promise<object>
Promise resolving to { data, error } tuple with updated function metadata
| Name | Type |
|---|---|
data | null | EdgeFunction |
error | null | Error |
Example
Section titled “Example”const { data, error } = await client.admin.functions.update('my-function', { enabled: false, description: 'Updated description'})