@fluxbase/sdk 0.0.1-rc.15 → 0.0.1-rc.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -149,24 +149,60 @@ interface PostgresChangesConfig {
149
149
  table: string;
150
150
  filter?: string;
151
151
  }
152
+ /**
153
+ * Realtime postgres_changes payload structure
154
+ * Compatible with Supabase realtime payloads
155
+ */
156
+ interface RealtimePostgresChangesPayload<T = any> {
157
+ /** Event type (Supabase-compatible field name) */
158
+ eventType: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
159
+ /** Database schema */
160
+ schema: string;
161
+ /** Table name */
162
+ table: string;
163
+ /** Commit timestamp (Supabase-compatible field name) */
164
+ commit_timestamp: string;
165
+ /** New record data (Supabase-compatible field name) */
166
+ new: T;
167
+ /** Old record data (Supabase-compatible field name) */
168
+ old: T;
169
+ /** Error message if any */
170
+ errors: string | null;
171
+ }
172
+ /**
173
+ * @deprecated Use RealtimePostgresChangesPayload instead
174
+ */
152
175
  interface RealtimeChangePayload {
176
+ /** @deprecated Use eventType instead */
153
177
  type: 'INSERT' | 'UPDATE' | 'DELETE';
154
178
  schema: string;
155
179
  table: string;
180
+ /** @deprecated Use 'new' instead */
156
181
  new_record?: Record<string, unknown>;
182
+ /** @deprecated Use 'old' instead */
157
183
  old_record?: Record<string, unknown>;
184
+ /** @deprecated Use commit_timestamp instead */
158
185
  timestamp: string;
159
186
  }
160
- type RealtimeCallback = (payload: RealtimeChangePayload) => void;
161
- interface StorageObject {
162
- key: string;
163
- bucket: string;
164
- size: number;
165
- content_type: string;
166
- last_modified: string;
167
- etag?: string;
168
- metadata?: Record<string, string>;
187
+ type RealtimeCallback = (payload: RealtimePostgresChangesPayload) => void;
188
+ /**
189
+ * File object returned by storage operations
190
+ * Compatible with Supabase FileObject structure
191
+ */
192
+ interface FileObject {
193
+ name: string;
194
+ id?: string;
195
+ bucket_id?: string;
196
+ owner?: string;
197
+ created_at?: string;
198
+ updated_at?: string;
199
+ last_accessed_at?: string;
200
+ metadata?: Record<string, any>;
169
201
  }
202
+ /**
203
+ * @deprecated Use FileObject instead. This alias is provided for backwards compatibility.
204
+ */
205
+ type StorageObject = FileObject;
170
206
  interface UploadOptions {
171
207
  contentType?: string;
172
208
  metadata?: Record<string, string>;
@@ -964,6 +1000,216 @@ interface AuthSubscription {
964
1000
  */
965
1001
  unsubscribe: () => void;
966
1002
  }
1003
+ /**
1004
+ * Options for invoking an edge function
1005
+ */
1006
+ interface FunctionInvokeOptions {
1007
+ /**
1008
+ * Request body to send to the function
1009
+ */
1010
+ body?: any;
1011
+ /**
1012
+ * Custom headers to include in the request
1013
+ */
1014
+ headers?: Record<string, string>;
1015
+ /**
1016
+ * HTTP method to use
1017
+ * @default 'POST'
1018
+ */
1019
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
1020
+ }
1021
+ /**
1022
+ * Edge function metadata
1023
+ */
1024
+ interface EdgeFunction {
1025
+ id: string;
1026
+ name: string;
1027
+ description?: string;
1028
+ code: string;
1029
+ version: number;
1030
+ enabled: boolean;
1031
+ timeout_seconds: number;
1032
+ memory_limit_mb: number;
1033
+ allow_net: boolean;
1034
+ allow_env: boolean;
1035
+ allow_read: boolean;
1036
+ allow_write: boolean;
1037
+ allow_unauthenticated: boolean;
1038
+ cron_schedule?: string;
1039
+ created_at: string;
1040
+ updated_at: string;
1041
+ created_by?: string;
1042
+ }
1043
+ /**
1044
+ * Request to create a new edge function
1045
+ */
1046
+ interface CreateFunctionRequest {
1047
+ name: string;
1048
+ description?: string;
1049
+ code: string;
1050
+ enabled?: boolean;
1051
+ timeout_seconds?: number;
1052
+ memory_limit_mb?: number;
1053
+ allow_net?: boolean;
1054
+ allow_env?: boolean;
1055
+ allow_read?: boolean;
1056
+ allow_write?: boolean;
1057
+ allow_unauthenticated?: boolean;
1058
+ cron_schedule?: string;
1059
+ }
1060
+ /**
1061
+ * Request to update an existing edge function
1062
+ */
1063
+ interface UpdateFunctionRequest {
1064
+ description?: string;
1065
+ code?: string;
1066
+ enabled?: boolean;
1067
+ timeout_seconds?: number;
1068
+ memory_limit_mb?: number;
1069
+ allow_net?: boolean;
1070
+ allow_env?: boolean;
1071
+ allow_read?: boolean;
1072
+ allow_write?: boolean;
1073
+ allow_unauthenticated?: boolean;
1074
+ cron_schedule?: string;
1075
+ }
1076
+ /**
1077
+ * Edge function execution record
1078
+ */
1079
+ interface EdgeFunctionExecution {
1080
+ id: string;
1081
+ function_id: string;
1082
+ trigger_type: string;
1083
+ status: 'success' | 'error';
1084
+ status_code?: number;
1085
+ duration_ms?: number;
1086
+ result?: string;
1087
+ logs?: string;
1088
+ error_message?: string;
1089
+ executed_at: string;
1090
+ completed_at?: string;
1091
+ }
1092
+
1093
+ /**
1094
+ * Realtime subscriptions using WebSockets
1095
+ */
1096
+
1097
+ declare class RealtimeChannel {
1098
+ private ws;
1099
+ private url;
1100
+ private token;
1101
+ private channelName;
1102
+ private callbacks;
1103
+ private subscriptionConfig;
1104
+ private reconnectAttempts;
1105
+ private maxReconnectAttempts;
1106
+ private reconnectDelay;
1107
+ private heartbeatInterval;
1108
+ constructor(url: string, channelName: string, token?: string | null);
1109
+ /**
1110
+ * Listen to postgres_changes with optional row-level filtering
1111
+ *
1112
+ * @param event - 'postgres_changes'
1113
+ * @param config - Configuration including optional filter
1114
+ * @param callback - Function to call when changes occur
1115
+ * @returns This channel for chaining
1116
+ *
1117
+ * @example
1118
+ * ```typescript
1119
+ * channel.on('postgres_changes', {
1120
+ * event: '*',
1121
+ * schema: 'public',
1122
+ * table: 'jobs',
1123
+ * filter: 'created_by=eq.user123'
1124
+ * }, (payload) => {
1125
+ * console.log('Job updated:', payload)
1126
+ * })
1127
+ * ```
1128
+ */
1129
+ on(event: "postgres_changes", config: PostgresChangesConfig, callback: RealtimeCallback): this;
1130
+ /**
1131
+ * Listen to a specific event type (backwards compatibility)
1132
+ *
1133
+ * @param event - The event type (INSERT, UPDATE, DELETE, or '*' for all)
1134
+ * @param callback - The callback function
1135
+ * @returns This channel for chaining
1136
+ *
1137
+ * @example
1138
+ * ```typescript
1139
+ * channel.on('INSERT', (payload) => {
1140
+ * console.log('New record inserted:', payload.new_record)
1141
+ * })
1142
+ * ```
1143
+ */
1144
+ on(event: "INSERT" | "UPDATE" | "DELETE" | "*", callback: RealtimeCallback): this;
1145
+ /**
1146
+ * Remove a callback
1147
+ */
1148
+ off(event: "INSERT" | "UPDATE" | "DELETE" | "*", callback: RealtimeCallback): this;
1149
+ /**
1150
+ * Subscribe to the channel
1151
+ * @param callback - Optional status callback (Supabase-compatible)
1152
+ * @param _timeout - Optional timeout in milliseconds (currently unused)
1153
+ */
1154
+ subscribe(callback?: (status: "SUBSCRIBED" | "CHANNEL_ERROR" | "TIMED_OUT" | "CLOSED", err?: Error) => void, _timeout?: number): this;
1155
+ /**
1156
+ * Unsubscribe from the channel
1157
+ * @param timeout - Optional timeout in milliseconds
1158
+ * @returns Promise resolving to status string (Supabase-compatible)
1159
+ */
1160
+ unsubscribe(timeout?: number): Promise<"ok" | "timed out" | "error">;
1161
+ /**
1162
+ * Internal: Connect to WebSocket
1163
+ */
1164
+ private connect;
1165
+ /**
1166
+ * Internal: Disconnect WebSocket
1167
+ */
1168
+ private disconnect;
1169
+ /**
1170
+ * Internal: Send a message
1171
+ */
1172
+ private send;
1173
+ /**
1174
+ * Internal: Handle incoming message
1175
+ */
1176
+ private handleMessage;
1177
+ /**
1178
+ * Internal: Handle broadcast message
1179
+ */
1180
+ private handleBroadcast;
1181
+ /**
1182
+ * Internal: Start heartbeat interval
1183
+ */
1184
+ private startHeartbeat;
1185
+ /**
1186
+ * Internal: Stop heartbeat interval
1187
+ */
1188
+ private stopHeartbeat;
1189
+ /**
1190
+ * Internal: Attempt to reconnect
1191
+ */
1192
+ private attemptReconnect;
1193
+ }
1194
+ declare class FluxbaseRealtime {
1195
+ private url;
1196
+ private token;
1197
+ private channels;
1198
+ constructor(url: string, token?: string | null);
1199
+ /**
1200
+ * Create or get a channel
1201
+ * @param channelName - Channel name (e.g., 'table:public.products')
1202
+ */
1203
+ channel(channelName: string): RealtimeChannel;
1204
+ /**
1205
+ * Remove all channels
1206
+ */
1207
+ removeAllChannels(): void;
1208
+ /**
1209
+ * Update auth token for all channels
1210
+ */
1211
+ setToken(token: string | null): void;
1212
+ }
967
1213
 
968
1214
  /**
969
1215
  * HTTP client for making requests to the Fluxbase API
@@ -1201,123 +1447,6 @@ declare class FluxbaseAuth {
1201
1447
  private emitAuthChange;
1202
1448
  }
1203
1449
 
1204
- /**
1205
- * Realtime subscriptions using WebSockets
1206
- */
1207
-
1208
- declare class RealtimeChannel {
1209
- private ws;
1210
- private url;
1211
- private token;
1212
- private channelName;
1213
- private callbacks;
1214
- private subscriptionConfig;
1215
- private reconnectAttempts;
1216
- private maxReconnectAttempts;
1217
- private reconnectDelay;
1218
- private heartbeatInterval;
1219
- constructor(url: string, channelName: string, token?: string | null);
1220
- /**
1221
- * Listen to postgres_changes with optional row-level filtering
1222
- *
1223
- * @param event - 'postgres_changes'
1224
- * @param config - Configuration including optional filter
1225
- * @param callback - Function to call when changes occur
1226
- * @returns This channel for chaining
1227
- *
1228
- * @example
1229
- * ```typescript
1230
- * channel.on('postgres_changes', {
1231
- * event: '*',
1232
- * schema: 'public',
1233
- * table: 'jobs',
1234
- * filter: 'created_by=eq.user123'
1235
- * }, (payload) => {
1236
- * console.log('Job updated:', payload)
1237
- * })
1238
- * ```
1239
- */
1240
- on(event: 'postgres_changes', config: PostgresChangesConfig, callback: RealtimeCallback): this;
1241
- /**
1242
- * Listen to a specific event type (backwards compatibility)
1243
- *
1244
- * @param event - The event type (INSERT, UPDATE, DELETE, or '*' for all)
1245
- * @param callback - The callback function
1246
- * @returns This channel for chaining
1247
- *
1248
- * @example
1249
- * ```typescript
1250
- * channel.on('INSERT', (payload) => {
1251
- * console.log('New record inserted:', payload.new_record)
1252
- * })
1253
- * ```
1254
- */
1255
- on(event: 'INSERT' | 'UPDATE' | 'DELETE' | '*', callback: RealtimeCallback): this;
1256
- /**
1257
- * Remove a callback
1258
- */
1259
- off(event: 'INSERT' | 'UPDATE' | 'DELETE' | '*', callback: RealtimeCallback): this;
1260
- /**
1261
- * Subscribe to the channel
1262
- */
1263
- subscribe(): this;
1264
- /**
1265
- * Unsubscribe from the channel
1266
- */
1267
- unsubscribe(): void;
1268
- /**
1269
- * Internal: Connect to WebSocket
1270
- */
1271
- private connect;
1272
- /**
1273
- * Internal: Disconnect WebSocket
1274
- */
1275
- private disconnect;
1276
- /**
1277
- * Internal: Send a message
1278
- */
1279
- private send;
1280
- /**
1281
- * Internal: Handle incoming message
1282
- */
1283
- private handleMessage;
1284
- /**
1285
- * Internal: Handle broadcast message
1286
- */
1287
- private handleBroadcast;
1288
- /**
1289
- * Internal: Start heartbeat interval
1290
- */
1291
- private startHeartbeat;
1292
- /**
1293
- * Internal: Stop heartbeat interval
1294
- */
1295
- private stopHeartbeat;
1296
- /**
1297
- * Internal: Attempt to reconnect
1298
- */
1299
- private attemptReconnect;
1300
- }
1301
- declare class FluxbaseRealtime {
1302
- private url;
1303
- private token;
1304
- private channels;
1305
- constructor(url: string, token?: string | null);
1306
- /**
1307
- * Create or get a channel
1308
- * @param channelName - Channel name (e.g., 'table:public.products')
1309
- */
1310
- channel(channelName: string): RealtimeChannel;
1311
- /**
1312
- * Remove all channels
1313
- */
1314
- removeAllChannels(): void;
1315
- /**
1316
- * Update auth token for all channels
1317
- */
1318
- setToken(token: string | null): void;
1319
- }
1320
-
1321
1450
  /**
1322
1451
  * Storage client for file operations
1323
1452
  */
@@ -1333,7 +1462,11 @@ declare class StorageBucket {
1333
1462
  * @param options - Upload options
1334
1463
  */
1335
1464
  upload(path: string, file: File | Blob | ArrayBuffer, options?: UploadOptions): Promise<{
1336
- data: StorageObject | null;
1465
+ data: {
1466
+ id: string;
1467
+ path: string;
1468
+ fullPath: string;
1469
+ } | null;
1337
1470
  error: Error | null;
1338
1471
  }>;
1339
1472
  /**
@@ -1346,10 +1479,12 @@ declare class StorageBucket {
1346
1479
  }>;
1347
1480
  /**
1348
1481
  * List files in the bucket
1349
- * @param options - List options (prefix, limit, offset)
1482
+ * Supports both Supabase-style list(path, options) and Fluxbase-style list(options)
1483
+ * @param pathOrOptions - The folder path or list options
1484
+ * @param maybeOptions - List options when first param is a path
1350
1485
  */
1351
- list(options?: ListOptions): Promise<{
1352
- data: StorageObject[] | null;
1486
+ list(pathOrOptions?: string | ListOptions, maybeOptions?: ListOptions): Promise<{
1487
+ data: FileObject[] | null;
1353
1488
  error: Error | null;
1354
1489
  }>;
1355
1490
  /**
@@ -1357,7 +1492,7 @@ declare class StorageBucket {
1357
1492
  * @param paths - Array of file paths to remove
1358
1493
  */
1359
1494
  remove(paths: string[]): Promise<{
1360
- data: null;
1495
+ data: FileObject[] | null;
1361
1496
  error: Error | null;
1362
1497
  }>;
1363
1498
  /**
@@ -1386,7 +1521,9 @@ declare class StorageBucket {
1386
1521
  * @param toPath - New file path
1387
1522
  */
1388
1523
  move(fromPath: string, toPath: string): Promise<{
1389
- data: StorageObject | null;
1524
+ data: {
1525
+ message: string;
1526
+ } | null;
1390
1527
  error: Error | null;
1391
1528
  }>;
1392
1529
  /**
@@ -1395,7 +1532,9 @@ declare class StorageBucket {
1395
1532
  * @param toPath - Destination file path
1396
1533
  */
1397
1534
  copy(fromPath: string, toPath: string): Promise<{
1398
- data: StorageObject | null;
1535
+ data: {
1536
+ path: string;
1537
+ } | null;
1399
1538
  error: Error | null;
1400
1539
  }>;
1401
1540
  /**
@@ -1448,7 +1587,9 @@ declare class FluxbaseStorage {
1448
1587
  * @param bucketName - The name of the bucket to create
1449
1588
  */
1450
1589
  createBucket(bucketName: string): Promise<{
1451
- data: null;
1590
+ data: {
1591
+ name: string;
1592
+ } | null;
1452
1593
  error: Error | null;
1453
1594
  }>;
1454
1595
  /**
@@ -1456,7 +1597,9 @@ declare class FluxbaseStorage {
1456
1597
  * @param bucketName - The name of the bucket to delete
1457
1598
  */
1458
1599
  deleteBucket(bucketName: string): Promise<{
1459
- data: null;
1600
+ data: {
1601
+ message: string;
1602
+ } | null;
1460
1603
  error: Error | null;
1461
1604
  }>;
1462
1605
  /**
@@ -1464,7 +1607,9 @@ declare class FluxbaseStorage {
1464
1607
  * @param bucketName - The name of the bucket to empty
1465
1608
  */
1466
1609
  emptyBucket(bucketName: string): Promise<{
1467
- data: null;
1610
+ data: {
1611
+ message: string;
1612
+ } | null;
1468
1613
  error: Error | null;
1469
1614
  }>;
1470
1615
  /**
@@ -1486,6 +1631,179 @@ declare class FluxbaseStorage {
1486
1631
  }>;
1487
1632
  }
1488
1633
 
1634
+ /**
1635
+ * Edge Functions module for Fluxbase SDK
1636
+ * Compatible with Supabase Functions API
1637
+ *
1638
+ * @example
1639
+ * ```typescript
1640
+ * // Invoke a function
1641
+ * const { data, error } = await client.functions.invoke('hello-world', {
1642
+ * body: { name: 'Alice' }
1643
+ * })
1644
+ *
1645
+ * // With custom headers
1646
+ * const { data, error } = await client.functions.invoke('api-call', {
1647
+ * body: { query: 'data' },
1648
+ * headers: { 'X-Custom-Header': 'value' },
1649
+ * method: 'POST'
1650
+ * })
1651
+ * ```
1652
+ */
1653
+
1654
+ /**
1655
+ * Edge Functions client for invoking and managing serverless functions
1656
+ * API-compatible with Supabase Functions
1657
+ *
1658
+ * @category Functions
1659
+ */
1660
+ declare class FluxbaseFunctions {
1661
+ private fetch;
1662
+ constructor(fetch: FluxbaseFetch);
1663
+ /**
1664
+ * Invoke an edge function
1665
+ *
1666
+ * This method is fully compatible with Supabase's functions.invoke() API.
1667
+ *
1668
+ * @param functionName - The name of the function to invoke
1669
+ * @param options - Invocation options including body, headers, and HTTP method
1670
+ * @returns Promise resolving to { data, error } tuple
1671
+ *
1672
+ * @example
1673
+ * ```typescript
1674
+ * // Simple invocation
1675
+ * const { data, error } = await client.functions.invoke('hello', {
1676
+ * body: { name: 'World' }
1677
+ * })
1678
+ *
1679
+ * // With GET method
1680
+ * const { data, error } = await client.functions.invoke('get-data', {
1681
+ * method: 'GET'
1682
+ * })
1683
+ *
1684
+ * // With custom headers
1685
+ * const { data, error } = await client.functions.invoke('api-proxy', {
1686
+ * body: { query: 'search' },
1687
+ * headers: { 'Authorization': 'Bearer token' },
1688
+ * method: 'POST'
1689
+ * })
1690
+ * ```
1691
+ */
1692
+ invoke<T = any>(functionName: string, options?: FunctionInvokeOptions): Promise<{
1693
+ data: T | null;
1694
+ error: Error | null;
1695
+ }>;
1696
+ /**
1697
+ * Create a new edge function
1698
+ *
1699
+ * @param request - Function configuration and code
1700
+ * @returns Promise resolving to { data, error } tuple with created function metadata
1701
+ *
1702
+ * @example
1703
+ * ```typescript
1704
+ * const { data, error } = await client.functions.create({
1705
+ * name: 'my-function',
1706
+ * code: 'export default async function handler(req) { return { hello: "world" } }',
1707
+ * enabled: true
1708
+ * })
1709
+ * ```
1710
+ */
1711
+ create(request: CreateFunctionRequest): Promise<{
1712
+ data: EdgeFunction | null;
1713
+ error: Error | null;
1714
+ }>;
1715
+ /**
1716
+ * List all edge functions
1717
+ *
1718
+ * @returns Promise resolving to { data, error } tuple with array of functions
1719
+ *
1720
+ * @example
1721
+ * ```typescript
1722
+ * const { data, error } = await client.functions.list()
1723
+ * if (data) {
1724
+ * console.log('Functions:', data.map(f => f.name))
1725
+ * }
1726
+ * ```
1727
+ */
1728
+ list(): Promise<{
1729
+ data: EdgeFunction[] | null;
1730
+ error: Error | null;
1731
+ }>;
1732
+ /**
1733
+ * Get details of a specific edge function
1734
+ *
1735
+ * @param name - Function name
1736
+ * @returns Promise resolving to { data, error } tuple with function metadata
1737
+ *
1738
+ * @example
1739
+ * ```typescript
1740
+ * const { data, error } = await client.functions.get('my-function')
1741
+ * if (data) {
1742
+ * console.log('Function version:', data.version)
1743
+ * }
1744
+ * ```
1745
+ */
1746
+ get(name: string): Promise<{
1747
+ data: EdgeFunction | null;
1748
+ error: Error | null;
1749
+ }>;
1750
+ /**
1751
+ * Update an existing edge function
1752
+ *
1753
+ * @param name - Function name
1754
+ * @param updates - Fields to update
1755
+ * @returns Promise resolving to { data, error } tuple with updated function metadata
1756
+ *
1757
+ * @example
1758
+ * ```typescript
1759
+ * const { data, error } = await client.functions.update('my-function', {
1760
+ * enabled: false,
1761
+ * description: 'Updated description'
1762
+ * })
1763
+ * ```
1764
+ */
1765
+ update(name: string, updates: UpdateFunctionRequest): Promise<{
1766
+ data: EdgeFunction | null;
1767
+ error: Error | null;
1768
+ }>;
1769
+ /**
1770
+ * Delete an edge function
1771
+ *
1772
+ * @param name - Function name
1773
+ * @returns Promise resolving to { data, error } tuple
1774
+ *
1775
+ * @example
1776
+ * ```typescript
1777
+ * const { data, error } = await client.functions.delete('my-function')
1778
+ * ```
1779
+ */
1780
+ delete(name: string): Promise<{
1781
+ data: null;
1782
+ error: Error | null;
1783
+ }>;
1784
+ /**
1785
+ * Get execution history for an edge function
1786
+ *
1787
+ * @param name - Function name
1788
+ * @param limit - Maximum number of executions to return (optional)
1789
+ * @returns Promise resolving to { data, error } tuple with execution records
1790
+ *
1791
+ * @example
1792
+ * ```typescript
1793
+ * const { data, error } = await client.functions.getExecutions('my-function', 10)
1794
+ * if (data) {
1795
+ * data.forEach(exec => {
1796
+ * console.log(`${exec.executed_at}: ${exec.status} (${exec.duration_ms}ms)`)
1797
+ * })
1798
+ * }
1799
+ * ```
1800
+ */
1801
+ getExecutions(name: string, limit?: number): Promise<{
1802
+ data: EdgeFunctionExecution[] | null;
1803
+ error: Error | null;
1804
+ }>;
1805
+ }
1806
+
1489
1807
  /**
1490
1808
  * System Settings Manager
1491
1809
  *
@@ -3851,40 +4169,6 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
3851
4169
  private formatValue;
3852
4170
  }
3853
4171
 
3854
- /**
3855
- * Main Fluxbase client for interacting with the Fluxbase backend.
3856
- *
3857
- * This client provides access to all Fluxbase features including:
3858
- * - Database operations via PostgREST-compatible API
3859
- * - Authentication and user management
3860
- * - Real-time subscriptions via WebSockets
3861
- * - File storage and management
3862
- * - PostgreSQL function calls (RPC)
3863
- *
3864
- * @example
3865
- * ```typescript
3866
- * import { createClient } from '@fluxbase/sdk'
3867
- *
3868
- * const client = createClient({
3869
- * url: 'http://localhost:8080',
3870
- * auth: {
3871
- * token: 'your-jwt-token',
3872
- * autoRefresh: true
3873
- * }
3874
- * })
3875
- *
3876
- * // Query database
3877
- * const { data } = await client.from('users').select('*').execute()
3878
- *
3879
- * // Subscribe to realtime changes
3880
- * client.realtime.subscribe('users', (payload) => {
3881
- * console.log('Change:', payload)
3882
- * })
3883
- * ```
3884
- *
3885
- * @category Client
3886
- */
3887
-
3888
4172
  /**
3889
4173
  * Main Fluxbase client class
3890
4174
  * @category Client
@@ -3898,6 +4182,8 @@ declare class FluxbaseClient {
3898
4182
  realtime: FluxbaseRealtime;
3899
4183
  /** Storage module for file operations */
3900
4184
  storage: FluxbaseStorage;
4185
+ /** Functions module for invoking and managing edge functions */
4186
+ functions: FluxbaseFunctions;
3901
4187
  /** Admin module for instance management (requires admin authentication) */
3902
4188
  admin: FluxbaseAdmin;
3903
4189
  /** Management module for API keys, webhooks, and invitations */
@@ -3980,6 +4266,34 @@ declare class FluxbaseClient {
3980
4266
  * @category Authentication
3981
4267
  */
3982
4268
  setAuthToken(token: string | null): void;
4269
+ /**
4270
+ * Create or get a realtime channel (Supabase-compatible alias)
4271
+ *
4272
+ * This is a convenience method that delegates to client.realtime.channel().
4273
+ * Both patterns work identically:
4274
+ * - client.channel('room-1') - Supabase-style
4275
+ * - client.realtime.channel('room-1') - Fluxbase-style
4276
+ *
4277
+ * @param name - Channel name
4278
+ * @returns RealtimeChannel instance
4279
+ *
4280
+ * @example
4281
+ * ```typescript
4282
+ * // Supabase-compatible usage
4283
+ * const channel = client.channel('room-1')
4284
+ * .on('postgres_changes', {
4285
+ * event: '*',
4286
+ * schema: 'public',
4287
+ * table: 'messages'
4288
+ * }, (payload) => {
4289
+ * console.log('Change:', payload)
4290
+ * })
4291
+ * .subscribe()
4292
+ * ```
4293
+ *
4294
+ * @category Realtime
4295
+ */
4296
+ channel(name: string): RealtimeChannel;
3983
4297
  /**
3984
4298
  * Get the internal HTTP client
3985
4299
  *
@@ -4025,4 +4339,4 @@ declare class FluxbaseClient {
4025
4339
  */
4026
4340
  declare function createClient(options: FluxbaseClientOptions): FluxbaseClient;
4027
4341
 
4028
- export { type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminUser, type AppSettings, AppSettingsManager, type AuthResponse, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type Column, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateColumnRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DeleteAPIKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type EmailSettings, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EnrichedUser, type FeatureSettings, type FilterOperator, FluxbaseAdmin, FluxbaseAuth, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, FluxbaseSettings, FluxbaseStorage, type GetImpersonationResponse, type HttpMethod, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgrestError, type PostgrestResponse, QueryBuilder, type QueryFilter, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeMessage, type RequestOptions, type ResetUserPasswordResponse, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type SESSettings, type SMTPSettings, type Schema, type SecuritySettings, type SendGridSettings, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SystemSetting, SystemSettingsManager, type Table, type TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateEmailTemplateRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateSystemSettingRequest, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type User, type ValidateInvitationResponse, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
4342
+ export { type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminUser, type AppSettings, AppSettingsManager, type AuthResponse, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type Column, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DeleteAPIKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type EdgeFunction, type EdgeFunctionExecution, type EmailSettings, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EnrichedUser, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAdmin, FluxbaseAuth, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, FluxbaseSettings, FluxbaseStorage, type FunctionInvokeOptions, type GetImpersonationResponse, type HttpMethod, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, QueryBuilder, type QueryFilter, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeMessage, type RealtimePostgresChangesPayload, type RequestOptions, type ResetUserPasswordResponse, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type SESSettings, type SMTPSettings, type Schema, type SecuritySettings, type SendGridSettings, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SystemSetting, SystemSettingsManager, type Table, type TestEmailTemplateRequest, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateSystemSettingRequest, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type User, type ValidateInvitationResponse, type Webhook, type WebhookDelivery, WebhooksManager, createClient };