@fluxbase/sdk 0.0.1-rc.17 → 0.0.1-rc.19
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 +360 -230
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -60
- package/dist/index.d.ts +145 -60
- package/dist/index.js +360 -230
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core types for the Fluxbase SDK
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Client configuration options (Supabase-compatible)
|
|
6
|
+
* These options are passed as the third parameter to createClient()
|
|
7
|
+
*/
|
|
4
8
|
interface FluxbaseClientOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Base URL of your Fluxbase instance
|
|
7
|
-
* @example 'https://api.myapp.com'
|
|
8
|
-
* @example 'http://localhost:8080'
|
|
9
|
-
*/
|
|
10
|
-
url: string;
|
|
11
9
|
/**
|
|
12
10
|
* Authentication options
|
|
13
11
|
*/
|
|
@@ -1089,6 +1087,58 @@ interface EdgeFunctionExecution {
|
|
|
1089
1087
|
executed_at: string;
|
|
1090
1088
|
completed_at?: string;
|
|
1091
1089
|
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Base Fluxbase response type (Supabase-compatible)
|
|
1092
|
+
* Returns either `{ data, error: null }` on success or `{ data: null, error }` on failure
|
|
1093
|
+
*/
|
|
1094
|
+
type FluxbaseResponse<T> = {
|
|
1095
|
+
data: T;
|
|
1096
|
+
error: null;
|
|
1097
|
+
} | {
|
|
1098
|
+
data: null;
|
|
1099
|
+
error: Error;
|
|
1100
|
+
};
|
|
1101
|
+
/**
|
|
1102
|
+
* Response type for operations that don't return data (void operations)
|
|
1103
|
+
*/
|
|
1104
|
+
type VoidResponse = {
|
|
1105
|
+
error: Error | null;
|
|
1106
|
+
};
|
|
1107
|
+
/**
|
|
1108
|
+
* Auth response with user and session
|
|
1109
|
+
*/
|
|
1110
|
+
type AuthResponseData = {
|
|
1111
|
+
user: User;
|
|
1112
|
+
session: AuthSession;
|
|
1113
|
+
};
|
|
1114
|
+
/**
|
|
1115
|
+
* Fluxbase auth response
|
|
1116
|
+
*/
|
|
1117
|
+
type FluxbaseAuthResponse = FluxbaseResponse<AuthResponseData>;
|
|
1118
|
+
/**
|
|
1119
|
+
* User response
|
|
1120
|
+
*/
|
|
1121
|
+
type UserResponse = FluxbaseResponse<{
|
|
1122
|
+
user: User;
|
|
1123
|
+
}>;
|
|
1124
|
+
/**
|
|
1125
|
+
* Session response
|
|
1126
|
+
*/
|
|
1127
|
+
type SessionResponse = FluxbaseResponse<{
|
|
1128
|
+
session: AuthSession;
|
|
1129
|
+
}>;
|
|
1130
|
+
/**
|
|
1131
|
+
* Generic data response
|
|
1132
|
+
*/
|
|
1133
|
+
type DataResponse<T> = FluxbaseResponse<T>;
|
|
1134
|
+
/**
|
|
1135
|
+
* @deprecated Use FluxbaseResponse instead
|
|
1136
|
+
*/
|
|
1137
|
+
type SupabaseResponse<T> = FluxbaseResponse<T>;
|
|
1138
|
+
/**
|
|
1139
|
+
* @deprecated Use FluxbaseAuthResponse instead
|
|
1140
|
+
*/
|
|
1141
|
+
type SupabaseAuthResponse = FluxbaseAuthResponse;
|
|
1092
1142
|
|
|
1093
1143
|
/**
|
|
1094
1144
|
* Realtime subscriptions using WebSockets
|
|
@@ -1309,33 +1359,33 @@ declare class FluxbaseAuth {
|
|
|
1309
1359
|
* Sign in with email and password
|
|
1310
1360
|
* Returns AuthSession if successful, or SignInWith2FAResponse if 2FA is required
|
|
1311
1361
|
*/
|
|
1312
|
-
signIn(credentials: SignInCredentials): Promise<AuthSession | SignInWith2FAResponse
|
|
1362
|
+
signIn(credentials: SignInCredentials): Promise<FluxbaseResponse<AuthSession | SignInWith2FAResponse>>;
|
|
1313
1363
|
/**
|
|
1314
1364
|
* Sign in with email and password
|
|
1315
1365
|
* Alias for signIn() to maintain compatibility with common authentication patterns
|
|
1316
1366
|
* Returns AuthSession if successful, or SignInWith2FAResponse if 2FA is required
|
|
1317
1367
|
*/
|
|
1318
|
-
signInWithPassword(credentials: SignInCredentials): Promise<AuthSession | SignInWith2FAResponse
|
|
1368
|
+
signInWithPassword(credentials: SignInCredentials): Promise<FluxbaseResponse<AuthSession | SignInWith2FAResponse>>;
|
|
1319
1369
|
/**
|
|
1320
1370
|
* Sign up with email and password
|
|
1321
1371
|
*/
|
|
1322
|
-
signUp(credentials: SignUpCredentials): Promise<
|
|
1372
|
+
signUp(credentials: SignUpCredentials): Promise<FluxbaseAuthResponse>;
|
|
1323
1373
|
/**
|
|
1324
1374
|
* Sign out the current user
|
|
1325
1375
|
*/
|
|
1326
|
-
signOut(): Promise<
|
|
1376
|
+
signOut(): Promise<VoidResponse>;
|
|
1327
1377
|
/**
|
|
1328
1378
|
* Refresh the access token
|
|
1329
1379
|
*/
|
|
1330
|
-
refreshToken(): Promise<
|
|
1380
|
+
refreshToken(): Promise<SessionResponse>;
|
|
1331
1381
|
/**
|
|
1332
1382
|
* Get the current user from the server
|
|
1333
1383
|
*/
|
|
1334
|
-
getCurrentUser(): Promise<
|
|
1384
|
+
getCurrentUser(): Promise<UserResponse>;
|
|
1335
1385
|
/**
|
|
1336
1386
|
* Update the current user
|
|
1337
1387
|
*/
|
|
1338
|
-
updateUser(data: Partial<Pick<User, "email" | "metadata">>): Promise<
|
|
1388
|
+
updateUser(data: Partial<Pick<User, "email" | "metadata">>): Promise<UserResponse>;
|
|
1339
1389
|
/**
|
|
1340
1390
|
* Set the auth token manually
|
|
1341
1391
|
*/
|
|
@@ -1344,87 +1394,98 @@ declare class FluxbaseAuth {
|
|
|
1344
1394
|
* Setup 2FA for the current user
|
|
1345
1395
|
* Returns TOTP secret and QR code URL
|
|
1346
1396
|
*/
|
|
1347
|
-
setup2FA(): Promise<TwoFactorSetupResponse
|
|
1397
|
+
setup2FA(): Promise<DataResponse<TwoFactorSetupResponse>>;
|
|
1348
1398
|
/**
|
|
1349
1399
|
* Enable 2FA after verifying the TOTP code
|
|
1350
1400
|
* Returns backup codes that should be saved by the user
|
|
1351
1401
|
*/
|
|
1352
|
-
enable2FA(code: string): Promise<TwoFactorEnableResponse
|
|
1402
|
+
enable2FA(code: string): Promise<DataResponse<TwoFactorEnableResponse>>;
|
|
1353
1403
|
/**
|
|
1354
1404
|
* Disable 2FA for the current user
|
|
1355
1405
|
* Requires password confirmation
|
|
1356
1406
|
*/
|
|
1357
|
-
disable2FA(password: string): Promise<{
|
|
1407
|
+
disable2FA(password: string): Promise<DataResponse<{
|
|
1358
1408
|
success: boolean;
|
|
1359
1409
|
message: string;
|
|
1360
|
-
}
|
|
1410
|
+
}>>;
|
|
1361
1411
|
/**
|
|
1362
1412
|
* Check 2FA status for the current user
|
|
1363
1413
|
*/
|
|
1364
|
-
get2FAStatus(): Promise<TwoFactorStatusResponse
|
|
1414
|
+
get2FAStatus(): Promise<DataResponse<TwoFactorStatusResponse>>;
|
|
1365
1415
|
/**
|
|
1366
1416
|
* Verify 2FA code during login
|
|
1367
1417
|
* Call this after signIn returns requires_2fa: true
|
|
1368
1418
|
*/
|
|
1369
|
-
verify2FA(request: TwoFactorVerifyRequest): Promise<
|
|
1419
|
+
verify2FA(request: TwoFactorVerifyRequest): Promise<FluxbaseAuthResponse>;
|
|
1370
1420
|
/**
|
|
1371
1421
|
* Send password reset email
|
|
1372
1422
|
* Sends a password reset link to the provided email address
|
|
1373
1423
|
* @param email - Email address to send reset link to
|
|
1374
1424
|
*/
|
|
1375
|
-
sendPasswordReset(email: string): Promise<PasswordResetResponse
|
|
1425
|
+
sendPasswordReset(email: string): Promise<DataResponse<PasswordResetResponse>>;
|
|
1426
|
+
/**
|
|
1427
|
+
* Supabase-compatible alias for sendPasswordReset()
|
|
1428
|
+
* @param email - Email address to send reset link to
|
|
1429
|
+
* @param _options - Optional redirect configuration (currently not used)
|
|
1430
|
+
*/
|
|
1431
|
+
resetPasswordForEmail(email: string, _options?: {
|
|
1432
|
+
redirectTo?: string;
|
|
1433
|
+
}): Promise<DataResponse<PasswordResetResponse>>;
|
|
1376
1434
|
/**
|
|
1377
1435
|
* Verify password reset token
|
|
1378
1436
|
* Check if a password reset token is valid before allowing password reset
|
|
1379
1437
|
* @param token - Password reset token to verify
|
|
1380
1438
|
*/
|
|
1381
|
-
verifyResetToken(token: string): Promise<VerifyResetTokenResponse
|
|
1439
|
+
verifyResetToken(token: string): Promise<DataResponse<VerifyResetTokenResponse>>;
|
|
1382
1440
|
/**
|
|
1383
1441
|
* Reset password with token
|
|
1384
1442
|
* Complete the password reset process with a valid token
|
|
1385
1443
|
* @param token - Password reset token
|
|
1386
1444
|
* @param newPassword - New password to set
|
|
1387
1445
|
*/
|
|
1388
|
-
resetPassword(token: string, newPassword: string): Promise<ResetPasswordResponse
|
|
1446
|
+
resetPassword(token: string, newPassword: string): Promise<DataResponse<ResetPasswordResponse>>;
|
|
1389
1447
|
/**
|
|
1390
1448
|
* Send magic link for passwordless authentication
|
|
1391
1449
|
* @param email - Email address to send magic link to
|
|
1392
1450
|
* @param options - Optional configuration for magic link
|
|
1393
1451
|
*/
|
|
1394
|
-
sendMagicLink(email: string, options?: MagicLinkOptions): Promise<MagicLinkResponse
|
|
1452
|
+
sendMagicLink(email: string, options?: MagicLinkOptions): Promise<DataResponse<MagicLinkResponse>>;
|
|
1395
1453
|
/**
|
|
1396
1454
|
* Verify magic link token and sign in
|
|
1397
1455
|
* @param token - Magic link token from email
|
|
1398
1456
|
*/
|
|
1399
|
-
verifyMagicLink(token: string): Promise<
|
|
1457
|
+
verifyMagicLink(token: string): Promise<FluxbaseAuthResponse>;
|
|
1400
1458
|
/**
|
|
1401
1459
|
* Sign in anonymously
|
|
1402
1460
|
* Creates a temporary anonymous user session
|
|
1403
1461
|
*/
|
|
1404
|
-
signInAnonymously(): Promise<
|
|
1462
|
+
signInAnonymously(): Promise<FluxbaseAuthResponse>;
|
|
1405
1463
|
/**
|
|
1406
1464
|
* Get list of enabled OAuth providers
|
|
1407
1465
|
*/
|
|
1408
|
-
getOAuthProviders(): Promise<OAuthProvidersResponse
|
|
1466
|
+
getOAuthProviders(): Promise<DataResponse<OAuthProvidersResponse>>;
|
|
1409
1467
|
/**
|
|
1410
1468
|
* Get OAuth authorization URL for a provider
|
|
1411
1469
|
* @param provider - OAuth provider name (e.g., 'google', 'github')
|
|
1412
1470
|
* @param options - Optional OAuth configuration
|
|
1413
1471
|
*/
|
|
1414
|
-
getOAuthUrl(provider: string, options?: OAuthOptions): Promise<OAuthUrlResponse
|
|
1472
|
+
getOAuthUrl(provider: string, options?: OAuthOptions): Promise<DataResponse<OAuthUrlResponse>>;
|
|
1415
1473
|
/**
|
|
1416
1474
|
* Exchange OAuth authorization code for session
|
|
1417
1475
|
* This is typically called in your OAuth callback handler
|
|
1418
1476
|
* @param code - Authorization code from OAuth callback
|
|
1419
1477
|
*/
|
|
1420
|
-
exchangeCodeForSession(code: string): Promise<
|
|
1478
|
+
exchangeCodeForSession(code: string): Promise<FluxbaseAuthResponse>;
|
|
1421
1479
|
/**
|
|
1422
1480
|
* Convenience method to initiate OAuth sign-in
|
|
1423
1481
|
* Redirects the user to the OAuth provider's authorization page
|
|
1424
1482
|
* @param provider - OAuth provider name (e.g., 'google', 'github')
|
|
1425
1483
|
* @param options - Optional OAuth configuration
|
|
1426
1484
|
*/
|
|
1427
|
-
signInWithOAuth(provider: string, options?: OAuthOptions): Promise<
|
|
1485
|
+
signInWithOAuth(provider: string, options?: OAuthOptions): Promise<DataResponse<{
|
|
1486
|
+
provider: string;
|
|
1487
|
+
url: string;
|
|
1488
|
+
}>>;
|
|
1428
1489
|
/**
|
|
1429
1490
|
* Internal: Set the session and persist it
|
|
1430
1491
|
*/
|
|
@@ -3620,7 +3681,7 @@ declare class FluxbaseAdmin {
|
|
|
3620
3681
|
* }
|
|
3621
3682
|
* ```
|
|
3622
3683
|
*/
|
|
3623
|
-
getSetupStatus(): Promise<AdminSetupStatusResponse
|
|
3684
|
+
getSetupStatus(): Promise<DataResponse<AdminSetupStatusResponse>>;
|
|
3624
3685
|
/**
|
|
3625
3686
|
* Perform initial admin setup
|
|
3626
3687
|
*
|
|
@@ -3644,7 +3705,7 @@ declare class FluxbaseAdmin {
|
|
|
3644
3705
|
* localStorage.setItem('admin_token', response.access_token);
|
|
3645
3706
|
* ```
|
|
3646
3707
|
*/
|
|
3647
|
-
setup(request: AdminSetupRequest): Promise<AdminAuthResponse
|
|
3708
|
+
setup(request: AdminSetupRequest): Promise<DataResponse<AdminAuthResponse>>;
|
|
3648
3709
|
/**
|
|
3649
3710
|
* Admin login
|
|
3650
3711
|
*
|
|
@@ -3665,7 +3726,7 @@ declare class FluxbaseAdmin {
|
|
|
3665
3726
|
* console.log('Logged in as:', response.user.email);
|
|
3666
3727
|
* ```
|
|
3667
3728
|
*/
|
|
3668
|
-
login(request: AdminLoginRequest): Promise<AdminAuthResponse
|
|
3729
|
+
login(request: AdminLoginRequest): Promise<DataResponse<AdminAuthResponse>>;
|
|
3669
3730
|
/**
|
|
3670
3731
|
* Refresh admin access token
|
|
3671
3732
|
*
|
|
@@ -3682,7 +3743,7 @@ declare class FluxbaseAdmin {
|
|
|
3682
3743
|
* localStorage.setItem('admin_refresh_token', response.refresh_token);
|
|
3683
3744
|
* ```
|
|
3684
3745
|
*/
|
|
3685
|
-
refreshToken(request: AdminRefreshRequest): Promise<AdminRefreshResponse
|
|
3746
|
+
refreshToken(request: AdminRefreshRequest): Promise<DataResponse<AdminRefreshResponse>>;
|
|
3686
3747
|
/**
|
|
3687
3748
|
* Admin logout
|
|
3688
3749
|
*
|
|
@@ -3694,7 +3755,7 @@ declare class FluxbaseAdmin {
|
|
|
3694
3755
|
* localStorage.removeItem('admin_token');
|
|
3695
3756
|
* ```
|
|
3696
3757
|
*/
|
|
3697
|
-
logout(): Promise<
|
|
3758
|
+
logout(): Promise<VoidResponse>;
|
|
3698
3759
|
/**
|
|
3699
3760
|
* Get current admin user information
|
|
3700
3761
|
*
|
|
@@ -3707,7 +3768,7 @@ declare class FluxbaseAdmin {
|
|
|
3707
3768
|
* console.log('Role:', user.role);
|
|
3708
3769
|
* ```
|
|
3709
3770
|
*/
|
|
3710
|
-
me(): Promise<AdminMeResponse
|
|
3771
|
+
me(): Promise<DataResponse<AdminMeResponse>>;
|
|
3711
3772
|
/**
|
|
3712
3773
|
* List all users
|
|
3713
3774
|
*
|
|
@@ -3728,7 +3789,7 @@ declare class FluxbaseAdmin {
|
|
|
3728
3789
|
* });
|
|
3729
3790
|
* ```
|
|
3730
3791
|
*/
|
|
3731
|
-
listUsers(options?: ListUsersOptions): Promise<ListUsersResponse
|
|
3792
|
+
listUsers(options?: ListUsersOptions): Promise<DataResponse<ListUsersResponse>>;
|
|
3732
3793
|
/**
|
|
3733
3794
|
* Get a user by ID
|
|
3734
3795
|
*
|
|
@@ -3749,7 +3810,7 @@ declare class FluxbaseAdmin {
|
|
|
3749
3810
|
* console.log('Last login:', dashboardUser.last_login_at);
|
|
3750
3811
|
* ```
|
|
3751
3812
|
*/
|
|
3752
|
-
getUserById(userId: string, type?: "app" | "dashboard"): Promise<EnrichedUser
|
|
3813
|
+
getUserById(userId: string, type?: "app" | "dashboard"): Promise<DataResponse<EnrichedUser>>;
|
|
3753
3814
|
/**
|
|
3754
3815
|
* Invite a new user
|
|
3755
3816
|
*
|
|
@@ -3771,7 +3832,7 @@ declare class FluxbaseAdmin {
|
|
|
3771
3832
|
* console.log('Invitation link:', response.invitation_link);
|
|
3772
3833
|
* ```
|
|
3773
3834
|
*/
|
|
3774
|
-
inviteUser(request: InviteUserRequest, type?: "app" | "dashboard"): Promise<InviteUserResponse
|
|
3835
|
+
inviteUser(request: InviteUserRequest, type?: "app" | "dashboard"): Promise<DataResponse<InviteUserResponse>>;
|
|
3775
3836
|
/**
|
|
3776
3837
|
* Delete a user
|
|
3777
3838
|
*
|
|
@@ -3787,7 +3848,7 @@ declare class FluxbaseAdmin {
|
|
|
3787
3848
|
* console.log('User deleted');
|
|
3788
3849
|
* ```
|
|
3789
3850
|
*/
|
|
3790
|
-
deleteUser(userId: string, type?: "app" | "dashboard"): Promise<DeleteUserResponse
|
|
3851
|
+
deleteUser(userId: string, type?: "app" | "dashboard"): Promise<DataResponse<DeleteUserResponse>>;
|
|
3791
3852
|
/**
|
|
3792
3853
|
* Update user role
|
|
3793
3854
|
*
|
|
@@ -3804,7 +3865,7 @@ declare class FluxbaseAdmin {
|
|
|
3804
3865
|
* console.log('User role updated:', user.role);
|
|
3805
3866
|
* ```
|
|
3806
3867
|
*/
|
|
3807
|
-
updateUserRole(userId: string, role: string, type?: "app" | "dashboard"): Promise<EnrichedUser
|
|
3868
|
+
updateUserRole(userId: string, role: string, type?: "app" | "dashboard"): Promise<DataResponse<EnrichedUser>>;
|
|
3808
3869
|
/**
|
|
3809
3870
|
* Reset user password
|
|
3810
3871
|
*
|
|
@@ -3820,7 +3881,7 @@ declare class FluxbaseAdmin {
|
|
|
3820
3881
|
* console.log(response.message);
|
|
3821
3882
|
* ```
|
|
3822
3883
|
*/
|
|
3823
|
-
resetUserPassword(userId: string, type?: "app" | "dashboard"): Promise<ResetUserPasswordResponse
|
|
3884
|
+
resetUserPassword(userId: string, type?: "app" | "dashboard"): Promise<DataResponse<ResetUserPasswordResponse>>;
|
|
3824
3885
|
}
|
|
3825
3886
|
|
|
3826
3887
|
/**
|
|
@@ -4173,7 +4234,9 @@ declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse
|
|
|
4173
4234
|
* Main Fluxbase client class
|
|
4174
4235
|
* @category Client
|
|
4175
4236
|
*/
|
|
4176
|
-
declare class FluxbaseClient {
|
|
4237
|
+
declare class FluxbaseClient<Database = any, _SchemaName extends string & keyof Database = any> {
|
|
4238
|
+
protected fluxbaseUrl: string;
|
|
4239
|
+
protected fluxbaseKey: string;
|
|
4177
4240
|
/** Internal HTTP client for making requests */
|
|
4178
4241
|
private fetch;
|
|
4179
4242
|
/** Authentication module for user management */
|
|
@@ -4190,9 +4253,21 @@ declare class FluxbaseClient {
|
|
|
4190
4253
|
management: FluxbaseManagement;
|
|
4191
4254
|
/**
|
|
4192
4255
|
* Create a new Fluxbase client instance
|
|
4193
|
-
*
|
|
4256
|
+
*
|
|
4257
|
+
* @param fluxbaseUrl - The URL of your Fluxbase instance
|
|
4258
|
+
* @param fluxbaseKey - The anon key (JWT token with "anon" role). Generate using scripts/generate-keys.sh
|
|
4259
|
+
* @param options - Additional client configuration options
|
|
4260
|
+
*
|
|
4261
|
+
* @example
|
|
4262
|
+
* ```typescript
|
|
4263
|
+
* const client = new FluxbaseClient(
|
|
4264
|
+
* 'http://localhost:8080',
|
|
4265
|
+
* 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...', // Anon JWT token
|
|
4266
|
+
* { timeout: 30000 }
|
|
4267
|
+
* )
|
|
4268
|
+
* ```
|
|
4194
4269
|
*/
|
|
4195
|
-
constructor(
|
|
4270
|
+
constructor(fluxbaseUrl: string, fluxbaseKey: string, options?: FluxbaseClientOptions);
|
|
4196
4271
|
/**
|
|
4197
4272
|
* Create a query builder for a database table
|
|
4198
4273
|
*
|
|
@@ -4312,31 +4387,41 @@ declare class FluxbaseClient {
|
|
|
4312
4387
|
get http(): FluxbaseFetch;
|
|
4313
4388
|
}
|
|
4314
4389
|
/**
|
|
4315
|
-
* Create a new Fluxbase client instance
|
|
4390
|
+
* Create a new Fluxbase client instance (Supabase-compatible)
|
|
4316
4391
|
*
|
|
4317
|
-
* This
|
|
4392
|
+
* This function signature is identical to Supabase's createClient, making migration seamless.
|
|
4318
4393
|
*
|
|
4319
|
-
* @param
|
|
4320
|
-
* @
|
|
4394
|
+
* @param fluxbaseUrl - The URL of your Fluxbase instance
|
|
4395
|
+
* @param fluxbaseKey - The anon key (JWT token with "anon" role). Generate using: `./scripts/generate-keys.sh` (option 3)
|
|
4396
|
+
* @param options - Optional client configuration
|
|
4397
|
+
* @returns A configured Fluxbase client instance with full TypeScript support
|
|
4321
4398
|
*
|
|
4322
4399
|
* @example
|
|
4323
4400
|
* ```typescript
|
|
4324
4401
|
* import { createClient } from '@fluxbase/sdk'
|
|
4325
4402
|
*
|
|
4326
|
-
*
|
|
4327
|
-
*
|
|
4328
|
-
*
|
|
4329
|
-
*
|
|
4330
|
-
*
|
|
4331
|
-
*
|
|
4332
|
-
*
|
|
4333
|
-
*
|
|
4334
|
-
*
|
|
4335
|
-
*
|
|
4403
|
+
* // Initialize with anon key (identical to Supabase)
|
|
4404
|
+
* const client = createClient(
|
|
4405
|
+
* 'http://localhost:8080',
|
|
4406
|
+
* 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' // Anon JWT token
|
|
4407
|
+
* )
|
|
4408
|
+
*
|
|
4409
|
+
* // With additional options
|
|
4410
|
+
* const client = createClient(
|
|
4411
|
+
* 'http://localhost:8080',
|
|
4412
|
+
* 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
|
|
4413
|
+
* { timeout: 30000, debug: true }
|
|
4414
|
+
* )
|
|
4415
|
+
*
|
|
4416
|
+
* // With TypeScript database types
|
|
4417
|
+
* const client = createClient<Database>(
|
|
4418
|
+
* 'http://localhost:8080',
|
|
4419
|
+
* 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
|
|
4420
|
+
* )
|
|
4336
4421
|
* ```
|
|
4337
4422
|
*
|
|
4338
4423
|
* @category Client
|
|
4339
4424
|
*/
|
|
4340
|
-
declare function createClient(
|
|
4425
|
+
declare function createClient<Database = any, SchemaName extends string & keyof Database = any>(fluxbaseUrl: string, fluxbaseKey: string, options?: FluxbaseClientOptions): FluxbaseClient<Database, SchemaName>;
|
|
4341
4426
|
|
|
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 };
|
|
4427
|
+
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, 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 User, type UserResponse, type ValidateInvitationResponse, type VoidResponse, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|