@fluxbase/sdk 0.0.1-rc.27 → 0.0.1-rc.29
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.cjs +345 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +324 -61
- package/dist/index.d.ts +324 -61
- package/dist/index.js +345 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -71,18 +71,55 @@ interface AuthResponse {
|
|
|
71
71
|
refresh_token: string;
|
|
72
72
|
expires_in: number;
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
/**
|
|
75
|
+
* MFA Factor (Supabase-compatible)
|
|
76
|
+
*/
|
|
77
|
+
interface Factor {
|
|
78
|
+
id: string;
|
|
79
|
+
type: 'totp' | 'phone';
|
|
80
|
+
status: 'verified' | 'unverified';
|
|
81
|
+
created_at: string;
|
|
82
|
+
updated_at: string;
|
|
83
|
+
friendly_name?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* TOTP setup details (Supabase-compatible)
|
|
87
|
+
*/
|
|
88
|
+
interface TOTPSetup {
|
|
89
|
+
qr_code: string;
|
|
75
90
|
secret: string;
|
|
76
|
-
|
|
77
|
-
message: string;
|
|
91
|
+
uri: string;
|
|
78
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* MFA enroll response (Supabase-compatible)
|
|
95
|
+
*/
|
|
96
|
+
interface TwoFactorSetupResponse {
|
|
97
|
+
id: string;
|
|
98
|
+
type: 'totp';
|
|
99
|
+
totp: TOTPSetup;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* MFA verify/enable response (Supabase-compatible)
|
|
103
|
+
*/
|
|
79
104
|
interface TwoFactorEnableResponse {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
access_token: string;
|
|
106
|
+
refresh_token: string;
|
|
107
|
+
user: User;
|
|
108
|
+
token_type?: string;
|
|
109
|
+
expires_in?: number;
|
|
83
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* MFA status response (Supabase-compatible)
|
|
113
|
+
*/
|
|
84
114
|
interface TwoFactorStatusResponse {
|
|
85
|
-
|
|
115
|
+
all: Factor[];
|
|
116
|
+
totp: Factor[];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* MFA unenroll response (Supabase-compatible)
|
|
120
|
+
*/
|
|
121
|
+
interface TwoFactorDisableResponse {
|
|
122
|
+
id: string;
|
|
86
123
|
}
|
|
87
124
|
interface TwoFactorVerifyRequest {
|
|
88
125
|
user_id: string;
|
|
@@ -131,7 +168,7 @@ interface OrderBy {
|
|
|
131
168
|
nulls?: 'first' | 'last';
|
|
132
169
|
}
|
|
133
170
|
interface RealtimeMessage {
|
|
134
|
-
type: 'subscribe' | 'unsubscribe' | 'heartbeat' | 'broadcast' | 'ack' | 'error';
|
|
171
|
+
type: 'subscribe' | 'unsubscribe' | 'heartbeat' | 'broadcast' | 'presence' | 'ack' | 'error';
|
|
135
172
|
channel?: string;
|
|
136
173
|
event?: string;
|
|
137
174
|
schema?: string;
|
|
@@ -140,6 +177,8 @@ interface RealtimeMessage {
|
|
|
140
177
|
payload?: unknown;
|
|
141
178
|
error?: string;
|
|
142
179
|
config?: PostgresChangesConfig;
|
|
180
|
+
presence?: any;
|
|
181
|
+
broadcast?: any;
|
|
143
182
|
}
|
|
144
183
|
interface PostgresChangesConfig {
|
|
145
184
|
event: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
@@ -183,6 +222,57 @@ interface RealtimeChangePayload {
|
|
|
183
222
|
timestamp: string;
|
|
184
223
|
}
|
|
185
224
|
type RealtimeCallback = (payload: RealtimePostgresChangesPayload) => void;
|
|
225
|
+
/**
|
|
226
|
+
* Realtime channel configuration options
|
|
227
|
+
*/
|
|
228
|
+
interface RealtimeChannelConfig {
|
|
229
|
+
broadcast?: {
|
|
230
|
+
self?: boolean;
|
|
231
|
+
ack?: boolean;
|
|
232
|
+
};
|
|
233
|
+
presence?: {
|
|
234
|
+
key?: string;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Presence state for a user
|
|
239
|
+
*/
|
|
240
|
+
interface PresenceState {
|
|
241
|
+
[key: string]: any;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Realtime presence payload structure
|
|
245
|
+
*/
|
|
246
|
+
interface RealtimePresencePayload {
|
|
247
|
+
event: 'sync' | 'join' | 'leave';
|
|
248
|
+
key?: string;
|
|
249
|
+
newPresences?: PresenceState[];
|
|
250
|
+
leftPresences?: PresenceState[];
|
|
251
|
+
currentPresences?: Record<string, PresenceState[]>;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Presence callback type
|
|
255
|
+
*/
|
|
256
|
+
type PresenceCallback = (payload: RealtimePresencePayload) => void;
|
|
257
|
+
/**
|
|
258
|
+
* Broadcast message structure
|
|
259
|
+
*/
|
|
260
|
+
interface BroadcastMessage {
|
|
261
|
+
type: 'broadcast';
|
|
262
|
+
event: string;
|
|
263
|
+
payload: any;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Realtime broadcast payload structure
|
|
267
|
+
*/
|
|
268
|
+
interface RealtimeBroadcastPayload {
|
|
269
|
+
event: string;
|
|
270
|
+
payload: any;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Broadcast callback type
|
|
274
|
+
*/
|
|
275
|
+
type BroadcastCallback = (payload: RealtimeBroadcastPayload) => void;
|
|
186
276
|
/**
|
|
187
277
|
* File object returned by storage operations
|
|
188
278
|
* Compatible with Supabase FileObject structure
|
|
@@ -251,21 +341,38 @@ interface Bucket {
|
|
|
251
341
|
created_at: string;
|
|
252
342
|
updated_at: string;
|
|
253
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Password reset email sent response (Supabase-compatible)
|
|
346
|
+
* Returns OTP-style response similar to Supabase's AuthOtpResponse
|
|
347
|
+
*/
|
|
254
348
|
interface PasswordResetResponse {
|
|
255
|
-
|
|
349
|
+
user: null;
|
|
350
|
+
session: null;
|
|
351
|
+
messageId?: string;
|
|
256
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Verify password reset token response (Fluxbase extension)
|
|
355
|
+
*/
|
|
257
356
|
interface VerifyResetTokenResponse {
|
|
258
357
|
valid: boolean;
|
|
259
358
|
message: string;
|
|
260
359
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Reset password completion response (Supabase-compatible)
|
|
362
|
+
* Returns user and session after successful password reset
|
|
363
|
+
*/
|
|
364
|
+
type ResetPasswordResponse = AuthResponseData;
|
|
264
365
|
interface MagicLinkOptions {
|
|
265
366
|
redirect_to?: string;
|
|
266
367
|
}
|
|
368
|
+
/**
|
|
369
|
+
* Magic link sent response (Supabase-compatible)
|
|
370
|
+
* Returns OTP-style response similar to Supabase's AuthOtpResponse
|
|
371
|
+
*/
|
|
267
372
|
interface MagicLinkResponse {
|
|
268
|
-
|
|
373
|
+
user: null;
|
|
374
|
+
session: null;
|
|
375
|
+
messageId?: string;
|
|
269
376
|
}
|
|
270
377
|
interface OAuthProvidersResponse {
|
|
271
378
|
providers: OAuthProvider[];
|
|
@@ -1092,11 +1199,18 @@ type VoidResponse = {
|
|
|
1092
1199
|
error: Error | null;
|
|
1093
1200
|
};
|
|
1094
1201
|
/**
|
|
1095
|
-
*
|
|
1202
|
+
* Weak password information (Supabase-compatible)
|
|
1203
|
+
*/
|
|
1204
|
+
interface WeakPassword {
|
|
1205
|
+
reasons: string[];
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Auth response with user and session (Supabase-compatible)
|
|
1096
1209
|
*/
|
|
1097
1210
|
type AuthResponseData = {
|
|
1098
1211
|
user: User;
|
|
1099
|
-
session: AuthSession;
|
|
1212
|
+
session: AuthSession | null;
|
|
1213
|
+
weakPassword?: WeakPassword;
|
|
1100
1214
|
};
|
|
1101
1215
|
/**
|
|
1102
1216
|
* Fluxbase auth response
|
|
@@ -1137,12 +1251,17 @@ declare class RealtimeChannel {
|
|
|
1137
1251
|
private token;
|
|
1138
1252
|
private channelName;
|
|
1139
1253
|
private callbacks;
|
|
1254
|
+
private presenceCallbacks;
|
|
1255
|
+
private broadcastCallbacks;
|
|
1140
1256
|
private subscriptionConfig;
|
|
1257
|
+
private _presenceState;
|
|
1258
|
+
private myPresenceKey;
|
|
1259
|
+
private config;
|
|
1141
1260
|
private reconnectAttempts;
|
|
1142
1261
|
private maxReconnectAttempts;
|
|
1143
1262
|
private reconnectDelay;
|
|
1144
1263
|
private heartbeatInterval;
|
|
1145
|
-
constructor(url: string, channelName: string, token?: string | null);
|
|
1264
|
+
constructor(url: string, channelName: string, token?: string | null, config?: RealtimeChannelConfig);
|
|
1146
1265
|
/**
|
|
1147
1266
|
* Listen to postgres_changes with optional row-level filtering
|
|
1148
1267
|
*
|
|
@@ -1179,6 +1298,42 @@ declare class RealtimeChannel {
|
|
|
1179
1298
|
* ```
|
|
1180
1299
|
*/
|
|
1181
1300
|
on(event: "INSERT" | "UPDATE" | "DELETE" | "*", callback: RealtimeCallback): this;
|
|
1301
|
+
/**
|
|
1302
|
+
* Listen to broadcast messages
|
|
1303
|
+
*
|
|
1304
|
+
* @param event - 'broadcast'
|
|
1305
|
+
* @param config - Configuration with event name
|
|
1306
|
+
* @param callback - Function to call when broadcast received
|
|
1307
|
+
* @returns This channel for chaining
|
|
1308
|
+
*
|
|
1309
|
+
* @example
|
|
1310
|
+
* ```typescript
|
|
1311
|
+
* channel.on('broadcast', { event: 'cursor-pos' }, (payload) => {
|
|
1312
|
+
* console.log('Cursor moved:', payload)
|
|
1313
|
+
* })
|
|
1314
|
+
* ```
|
|
1315
|
+
*/
|
|
1316
|
+
on(event: "broadcast", config: {
|
|
1317
|
+
event: string;
|
|
1318
|
+
}, callback: BroadcastCallback): this;
|
|
1319
|
+
/**
|
|
1320
|
+
* Listen to presence events
|
|
1321
|
+
*
|
|
1322
|
+
* @param event - 'presence'
|
|
1323
|
+
* @param config - Configuration with event type (sync, join, leave)
|
|
1324
|
+
* @param callback - Function to call when presence changes
|
|
1325
|
+
* @returns This channel for chaining
|
|
1326
|
+
*
|
|
1327
|
+
* @example
|
|
1328
|
+
* ```typescript
|
|
1329
|
+
* channel.on('presence', { event: 'sync' }, (payload) => {
|
|
1330
|
+
* console.log('Presence synced:', payload)
|
|
1331
|
+
* })
|
|
1332
|
+
* ```
|
|
1333
|
+
*/
|
|
1334
|
+
on(event: "presence", config: {
|
|
1335
|
+
event: "sync" | "join" | "leave";
|
|
1336
|
+
}, callback: PresenceCallback): this;
|
|
1182
1337
|
/**
|
|
1183
1338
|
* Remove a callback
|
|
1184
1339
|
*/
|
|
@@ -1195,6 +1350,60 @@ declare class RealtimeChannel {
|
|
|
1195
1350
|
* @returns Promise resolving to status string (Supabase-compatible)
|
|
1196
1351
|
*/
|
|
1197
1352
|
unsubscribe(timeout?: number): Promise<"ok" | "timed out" | "error">;
|
|
1353
|
+
/**
|
|
1354
|
+
* Send a broadcast message to all subscribers on this channel
|
|
1355
|
+
*
|
|
1356
|
+
* @param message - Broadcast message with type, event, and payload
|
|
1357
|
+
* @returns Promise resolving to status
|
|
1358
|
+
*
|
|
1359
|
+
* @example
|
|
1360
|
+
* ```typescript
|
|
1361
|
+
* await channel.send({
|
|
1362
|
+
* type: 'broadcast',
|
|
1363
|
+
* event: 'cursor-pos',
|
|
1364
|
+
* payload: { x: 100, y: 200 }
|
|
1365
|
+
* })
|
|
1366
|
+
* ```
|
|
1367
|
+
*/
|
|
1368
|
+
send(message: BroadcastMessage): Promise<"ok" | "error">;
|
|
1369
|
+
/**
|
|
1370
|
+
* Track user presence on this channel
|
|
1371
|
+
*
|
|
1372
|
+
* @param state - Presence state to track
|
|
1373
|
+
* @returns Promise resolving to status
|
|
1374
|
+
*
|
|
1375
|
+
* @example
|
|
1376
|
+
* ```typescript
|
|
1377
|
+
* await channel.track({
|
|
1378
|
+
* user_id: 123,
|
|
1379
|
+
* status: 'online'
|
|
1380
|
+
* })
|
|
1381
|
+
* ```
|
|
1382
|
+
*/
|
|
1383
|
+
track(state: PresenceState): Promise<"ok" | "error">;
|
|
1384
|
+
/**
|
|
1385
|
+
* Stop tracking presence on this channel
|
|
1386
|
+
*
|
|
1387
|
+
* @returns Promise resolving to status
|
|
1388
|
+
*
|
|
1389
|
+
* @example
|
|
1390
|
+
* ```typescript
|
|
1391
|
+
* await channel.untrack()
|
|
1392
|
+
* ```
|
|
1393
|
+
*/
|
|
1394
|
+
untrack(): Promise<"ok" | "error">;
|
|
1395
|
+
/**
|
|
1396
|
+
* Get current presence state for all users on this channel
|
|
1397
|
+
*
|
|
1398
|
+
* @returns Current presence state
|
|
1399
|
+
*
|
|
1400
|
+
* @example
|
|
1401
|
+
* ```typescript
|
|
1402
|
+
* const state = channel.presenceState()
|
|
1403
|
+
* console.log('Online users:', Object.keys(state).length)
|
|
1404
|
+
* ```
|
|
1405
|
+
*/
|
|
1406
|
+
presenceState(): Record<string, PresenceState[]>;
|
|
1198
1407
|
/**
|
|
1199
1408
|
* Internal: Connect to WebSocket
|
|
1200
1409
|
*/
|
|
@@ -1206,7 +1415,7 @@ declare class RealtimeChannel {
|
|
|
1206
1415
|
/**
|
|
1207
1416
|
* Internal: Send a message
|
|
1208
1417
|
*/
|
|
1209
|
-
private
|
|
1418
|
+
private sendMessage;
|
|
1210
1419
|
/**
|
|
1211
1420
|
* Internal: Handle incoming message
|
|
1212
1421
|
*/
|
|
@@ -1214,7 +1423,15 @@ declare class RealtimeChannel {
|
|
|
1214
1423
|
/**
|
|
1215
1424
|
* Internal: Handle broadcast message
|
|
1216
1425
|
*/
|
|
1217
|
-
private
|
|
1426
|
+
private handleBroadcastMessage;
|
|
1427
|
+
/**
|
|
1428
|
+
* Internal: Handle presence message
|
|
1429
|
+
*/
|
|
1430
|
+
private handlePresenceMessage;
|
|
1431
|
+
/**
|
|
1432
|
+
* Internal: Handle postgres_changes message
|
|
1433
|
+
*/
|
|
1434
|
+
private handlePostgresChanges;
|
|
1218
1435
|
/**
|
|
1219
1436
|
* Internal: Start heartbeat interval
|
|
1220
1437
|
*/
|
|
@@ -1234,18 +1451,43 @@ declare class FluxbaseRealtime {
|
|
|
1234
1451
|
private channels;
|
|
1235
1452
|
constructor(url: string, token?: string | null);
|
|
1236
1453
|
/**
|
|
1237
|
-
* Create or get a channel
|
|
1454
|
+
* Create or get a channel with optional configuration
|
|
1455
|
+
*
|
|
1238
1456
|
* @param channelName - Channel name (e.g., 'table:public.products')
|
|
1457
|
+
* @param config - Optional channel configuration
|
|
1458
|
+
* @returns RealtimeChannel instance
|
|
1459
|
+
*
|
|
1460
|
+
* @example
|
|
1461
|
+
* ```typescript
|
|
1462
|
+
* const channel = realtime.channel('room-1', {
|
|
1463
|
+
* broadcast: { self: true, ack: true },
|
|
1464
|
+
* presence: { key: 'user-123' }
|
|
1465
|
+
* })
|
|
1466
|
+
* ```
|
|
1239
1467
|
*/
|
|
1240
|
-
channel(channelName: string): RealtimeChannel;
|
|
1468
|
+
channel(channelName: string, config?: RealtimeChannelConfig): RealtimeChannel;
|
|
1469
|
+
/**
|
|
1470
|
+
* Remove a specific channel
|
|
1471
|
+
*
|
|
1472
|
+
* @param channel - The channel to remove
|
|
1473
|
+
* @returns Promise resolving to status
|
|
1474
|
+
*
|
|
1475
|
+
* @example
|
|
1476
|
+
* ```typescript
|
|
1477
|
+
* const channel = realtime.channel('room-1')
|
|
1478
|
+
* await realtime.removeChannel(channel)
|
|
1479
|
+
* ```
|
|
1480
|
+
*/
|
|
1481
|
+
removeChannel(channel: RealtimeChannel): Promise<"ok" | "error">;
|
|
1241
1482
|
/**
|
|
1242
1483
|
* Remove all channels
|
|
1243
1484
|
*/
|
|
1244
1485
|
removeAllChannels(): void;
|
|
1245
1486
|
/**
|
|
1246
1487
|
* Update auth token for all channels
|
|
1488
|
+
* @param token - The new auth token
|
|
1247
1489
|
*/
|
|
1248
|
-
|
|
1490
|
+
setAuth(token: string | null): void;
|
|
1249
1491
|
}
|
|
1250
1492
|
|
|
1251
1493
|
/**
|
|
@@ -1354,18 +1596,20 @@ declare class FluxbaseAuth {
|
|
|
1354
1596
|
};
|
|
1355
1597
|
};
|
|
1356
1598
|
/**
|
|
1357
|
-
* Sign in with email and password
|
|
1358
|
-
* Returns
|
|
1599
|
+
* Sign in with email and password (Supabase-compatible)
|
|
1600
|
+
* Returns { user, session } if successful, or SignInWith2FAResponse if 2FA is required
|
|
1359
1601
|
*/
|
|
1360
|
-
signIn(credentials: SignInCredentials): Promise<FluxbaseResponse<
|
|
1602
|
+
signIn(credentials: SignInCredentials): Promise<FluxbaseResponse<AuthResponseData | SignInWith2FAResponse>>;
|
|
1361
1603
|
/**
|
|
1362
|
-
* Sign in with email and password
|
|
1604
|
+
* Sign in with email and password (Supabase-compatible)
|
|
1363
1605
|
* Alias for signIn() to maintain compatibility with common authentication patterns
|
|
1364
|
-
* Returns
|
|
1606
|
+
* Returns { user, session } if successful, or SignInWith2FAResponse if 2FA is required
|
|
1365
1607
|
*/
|
|
1366
|
-
signInWithPassword(credentials: SignInCredentials): Promise<FluxbaseResponse<
|
|
1608
|
+
signInWithPassword(credentials: SignInCredentials): Promise<FluxbaseResponse<AuthResponseData | SignInWith2FAResponse>>;
|
|
1367
1609
|
/**
|
|
1368
|
-
* Sign up with email and password
|
|
1610
|
+
* Sign up with email and password (Supabase-compatible)
|
|
1611
|
+
* Returns session when email confirmation is disabled
|
|
1612
|
+
* Returns null session when email confirmation is required
|
|
1369
1613
|
*/
|
|
1370
1614
|
signUp(credentials: SignUpCredentials): Promise<FluxbaseAuthResponse>;
|
|
1371
1615
|
/**
|
|
@@ -1377,8 +1621,8 @@ declare class FluxbaseAuth {
|
|
|
1377
1621
|
* Returns a new session with refreshed tokens
|
|
1378
1622
|
*/
|
|
1379
1623
|
refreshSession(): Promise<FluxbaseResponse<{
|
|
1380
|
-
session: AuthSession;
|
|
1381
1624
|
user: User;
|
|
1625
|
+
session: AuthSession;
|
|
1382
1626
|
}>>;
|
|
1383
1627
|
/**
|
|
1384
1628
|
* Get the current user from the server
|
|
@@ -1399,42 +1643,50 @@ declare class FluxbaseAuth {
|
|
|
1399
1643
|
refresh_token: string;
|
|
1400
1644
|
}): Promise<FluxbaseAuthResponse>;
|
|
1401
1645
|
/**
|
|
1402
|
-
* Setup 2FA for the current user
|
|
1403
|
-
*
|
|
1646
|
+
* Setup 2FA for the current user (Supabase-compatible)
|
|
1647
|
+
* Enrolls a new MFA factor and returns TOTP details
|
|
1648
|
+
* @returns Promise with factor id, type, and TOTP setup details
|
|
1404
1649
|
*/
|
|
1405
1650
|
setup2FA(): Promise<DataResponse<TwoFactorSetupResponse>>;
|
|
1406
1651
|
/**
|
|
1407
|
-
* Enable 2FA after verifying the TOTP code
|
|
1408
|
-
*
|
|
1652
|
+
* Enable 2FA after verifying the TOTP code (Supabase-compatible)
|
|
1653
|
+
* Verifies the TOTP code and returns new tokens with MFA session
|
|
1654
|
+
* @param code - TOTP code from authenticator app
|
|
1655
|
+
* @returns Promise with access_token, refresh_token, and user
|
|
1409
1656
|
*/
|
|
1410
1657
|
enable2FA(code: string): Promise<DataResponse<TwoFactorEnableResponse>>;
|
|
1411
1658
|
/**
|
|
1412
|
-
* Disable 2FA for the current user
|
|
1413
|
-
*
|
|
1659
|
+
* Disable 2FA for the current user (Supabase-compatible)
|
|
1660
|
+
* Unenrolls the MFA factor
|
|
1661
|
+
* @param password - User password for confirmation
|
|
1662
|
+
* @returns Promise with unenrolled factor id
|
|
1414
1663
|
*/
|
|
1415
|
-
disable2FA(password: string): Promise<DataResponse<
|
|
1416
|
-
success: boolean;
|
|
1417
|
-
message: string;
|
|
1418
|
-
}>>;
|
|
1664
|
+
disable2FA(password: string): Promise<DataResponse<TwoFactorDisableResponse>>;
|
|
1419
1665
|
/**
|
|
1420
|
-
* Check 2FA status for the current user
|
|
1666
|
+
* Check 2FA status for the current user (Supabase-compatible)
|
|
1667
|
+
* Lists all enrolled MFA factors
|
|
1668
|
+
* @returns Promise with all factors and TOTP factors
|
|
1421
1669
|
*/
|
|
1422
1670
|
get2FAStatus(): Promise<DataResponse<TwoFactorStatusResponse>>;
|
|
1423
1671
|
/**
|
|
1424
|
-
* Verify 2FA code during login
|
|
1672
|
+
* Verify 2FA code during login (Supabase-compatible)
|
|
1425
1673
|
* Call this after signIn returns requires_2fa: true
|
|
1674
|
+
* @param request - User ID and TOTP code
|
|
1675
|
+
* @returns Promise with access_token, refresh_token, and user
|
|
1426
1676
|
*/
|
|
1427
|
-
verify2FA(request: TwoFactorVerifyRequest): Promise<
|
|
1677
|
+
verify2FA(request: TwoFactorVerifyRequest): Promise<DataResponse<TwoFactorEnableResponse>>;
|
|
1428
1678
|
/**
|
|
1429
|
-
* Send password reset email
|
|
1679
|
+
* Send password reset email (Supabase-compatible)
|
|
1430
1680
|
* Sends a password reset link to the provided email address
|
|
1431
1681
|
* @param email - Email address to send reset link to
|
|
1682
|
+
* @returns Promise with OTP-style response
|
|
1432
1683
|
*/
|
|
1433
1684
|
sendPasswordReset(email: string): Promise<DataResponse<PasswordResetResponse>>;
|
|
1434
1685
|
/**
|
|
1435
1686
|
* Supabase-compatible alias for sendPasswordReset()
|
|
1436
1687
|
* @param email - Email address to send reset link to
|
|
1437
1688
|
* @param _options - Optional redirect configuration (currently not used)
|
|
1689
|
+
* @returns Promise with OTP-style response
|
|
1438
1690
|
*/
|
|
1439
1691
|
resetPasswordForEmail(email: string, _options?: {
|
|
1440
1692
|
redirectTo?: string;
|
|
@@ -1446,16 +1698,18 @@ declare class FluxbaseAuth {
|
|
|
1446
1698
|
*/
|
|
1447
1699
|
verifyResetToken(token: string): Promise<DataResponse<VerifyResetTokenResponse>>;
|
|
1448
1700
|
/**
|
|
1449
|
-
* Reset password with token
|
|
1701
|
+
* Reset password with token (Supabase-compatible)
|
|
1450
1702
|
* Complete the password reset process with a valid token
|
|
1451
1703
|
* @param token - Password reset token
|
|
1452
1704
|
* @param newPassword - New password to set
|
|
1705
|
+
* @returns Promise with user and new session
|
|
1453
1706
|
*/
|
|
1454
1707
|
resetPassword(token: string, newPassword: string): Promise<DataResponse<ResetPasswordResponse>>;
|
|
1455
1708
|
/**
|
|
1456
|
-
* Send magic link for passwordless authentication
|
|
1709
|
+
* Send magic link for passwordless authentication (Supabase-compatible)
|
|
1457
1710
|
* @param email - Email address to send magic link to
|
|
1458
1711
|
* @param options - Optional configuration for magic link
|
|
1712
|
+
* @returns Promise with OTP-style response
|
|
1459
1713
|
*/
|
|
1460
1714
|
sendMagicLink(email: string, options?: MagicLinkOptions): Promise<DataResponse<MagicLinkResponse>>;
|
|
1461
1715
|
/**
|
|
@@ -4422,33 +4676,42 @@ declare class FluxbaseClient<Database = any, _SchemaName extends string & keyof
|
|
|
4422
4676
|
*/
|
|
4423
4677
|
setAuthToken(token: string | null): void;
|
|
4424
4678
|
/**
|
|
4425
|
-
* Create or get a realtime channel (Supabase-compatible
|
|
4426
|
-
*
|
|
4427
|
-
* This is a convenience method that delegates to client.realtime.channel().
|
|
4428
|
-
* Both patterns work identically:
|
|
4429
|
-
* - client.channel('room-1') - Supabase-style
|
|
4430
|
-
* - client.realtime.channel('room-1') - Fluxbase-style
|
|
4679
|
+
* Create or get a realtime channel (Supabase-compatible)
|
|
4431
4680
|
*
|
|
4432
4681
|
* @param name - Channel name
|
|
4682
|
+
* @param config - Optional channel configuration
|
|
4433
4683
|
* @returns RealtimeChannel instance
|
|
4434
4684
|
*
|
|
4435
4685
|
* @example
|
|
4436
4686
|
* ```typescript
|
|
4437
|
-
*
|
|
4438
|
-
*
|
|
4439
|
-
*
|
|
4440
|
-
*
|
|
4441
|
-
*
|
|
4442
|
-
*
|
|
4443
|
-
* }, (payload) => {
|
|
4444
|
-
* console.log('Change:', payload)
|
|
4687
|
+
* const channel = client.channel('room-1', {
|
|
4688
|
+
* broadcast: { self: true },
|
|
4689
|
+
* presence: { key: 'user-123' }
|
|
4690
|
+
* })
|
|
4691
|
+
* .on('broadcast', { event: 'message' }, (payload) => {
|
|
4692
|
+
* console.log('Message:', payload)
|
|
4445
4693
|
* })
|
|
4446
4694
|
* .subscribe()
|
|
4447
4695
|
* ```
|
|
4448
4696
|
*
|
|
4449
4697
|
* @category Realtime
|
|
4450
4698
|
*/
|
|
4451
|
-
channel(name: string): RealtimeChannel;
|
|
4699
|
+
channel(name: string, config?: RealtimeChannelConfig): RealtimeChannel;
|
|
4700
|
+
/**
|
|
4701
|
+
* Remove a realtime channel (Supabase-compatible)
|
|
4702
|
+
*
|
|
4703
|
+
* @param channel - The channel to remove
|
|
4704
|
+
* @returns Promise resolving to status
|
|
4705
|
+
*
|
|
4706
|
+
* @example
|
|
4707
|
+
* ```typescript
|
|
4708
|
+
* const channel = client.channel('room-1')
|
|
4709
|
+
* await client.removeChannel(channel)
|
|
4710
|
+
* ```
|
|
4711
|
+
*
|
|
4712
|
+
* @category Realtime
|
|
4713
|
+
*/
|
|
4714
|
+
removeChannel(channel: RealtimeChannel): Promise<"error" | "ok">;
|
|
4452
4715
|
/**
|
|
4453
4716
|
* Get the internal HTTP client
|
|
4454
4717
|
*
|
|
@@ -4504,4 +4767,4 @@ declare class FluxbaseClient<Database = any, _SchemaName extends string & keyof
|
|
|
4504
4767
|
*/
|
|
4505
4768
|
declare function createClient<Database = any, SchemaName extends string & keyof Database = any>(fluxbaseUrl: string, fluxbaseKey: string, options?: FluxbaseClientOptions): FluxbaseClient<Database, SchemaName>;
|
|
4506
4769
|
|
|
4507
|
-
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 DataResponse, 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, type FluxbaseAuthResponse, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, type FluxbaseResponse, 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 SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SupabaseAuthResponse, type SupabaseResponse, 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 UploadProgress, type User, type UserResponse, type ValidateInvitationResponse, type VoidResponse, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|
|
4770
|
+
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 AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, 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 DataResponse, 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, type FluxbaseAuthResponse, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseManagement, FluxbaseOAuth, FluxbaseRealtime, type FluxbaseResponse, 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, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type SESSettings, type SMTPSettings, type Schema, type SecuritySettings, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SupabaseAuthResponse, type SupabaseResponse, 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 UploadProgress, type User, type UserResponse, type ValidateInvitationResponse, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|