@fluxbase/sdk 0.0.1-rc.2
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/README.md +141 -0
- package/dist/index.cjs +3260 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3424 -0
- package/dist/index.d.ts +3424 -0
- package/dist/index.js +3237 -0
- package/dist/index.js.map +1 -0
- package/package.json +72 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,3424 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the Fluxbase SDK
|
|
3
|
+
*/
|
|
4
|
+
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
|
+
/**
|
|
12
|
+
* Authentication options
|
|
13
|
+
*/
|
|
14
|
+
auth?: {
|
|
15
|
+
/**
|
|
16
|
+
* Access token for authentication
|
|
17
|
+
*/
|
|
18
|
+
token?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Auto-refresh token when it expires
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
autoRefresh?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Persist auth state in localStorage
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
persist?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Global headers to include in all requests
|
|
32
|
+
*/
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Request timeout in milliseconds
|
|
36
|
+
* @default 30000
|
|
37
|
+
*/
|
|
38
|
+
timeout?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Enable debug logging
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
debug?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface AuthSession {
|
|
46
|
+
user: User;
|
|
47
|
+
access_token: string;
|
|
48
|
+
refresh_token: string;
|
|
49
|
+
expires_in: number;
|
|
50
|
+
expires_at?: number;
|
|
51
|
+
}
|
|
52
|
+
interface User {
|
|
53
|
+
id: string;
|
|
54
|
+
email: string;
|
|
55
|
+
email_verified: boolean;
|
|
56
|
+
role: string;
|
|
57
|
+
metadata?: Record<string, unknown> | null;
|
|
58
|
+
created_at: string;
|
|
59
|
+
updated_at: string;
|
|
60
|
+
}
|
|
61
|
+
interface SignInCredentials {
|
|
62
|
+
email: string;
|
|
63
|
+
password: string;
|
|
64
|
+
}
|
|
65
|
+
interface SignUpCredentials {
|
|
66
|
+
email: string;
|
|
67
|
+
password: string;
|
|
68
|
+
metadata?: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
interface AuthResponse {
|
|
71
|
+
user: User;
|
|
72
|
+
access_token: string;
|
|
73
|
+
refresh_token: string;
|
|
74
|
+
expires_in: number;
|
|
75
|
+
}
|
|
76
|
+
interface TwoFactorSetupResponse {
|
|
77
|
+
secret: string;
|
|
78
|
+
qr_code_url: string;
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
interface TwoFactorEnableResponse {
|
|
82
|
+
success: boolean;
|
|
83
|
+
backup_codes: string[];
|
|
84
|
+
message: string;
|
|
85
|
+
}
|
|
86
|
+
interface TwoFactorStatusResponse {
|
|
87
|
+
totp_enabled: boolean;
|
|
88
|
+
}
|
|
89
|
+
interface TwoFactorVerifyRequest {
|
|
90
|
+
user_id: string;
|
|
91
|
+
code: string;
|
|
92
|
+
}
|
|
93
|
+
interface SignInWith2FAResponse {
|
|
94
|
+
requires_2fa: boolean;
|
|
95
|
+
user_id: string;
|
|
96
|
+
message: string;
|
|
97
|
+
}
|
|
98
|
+
interface FluxbaseError extends Error {
|
|
99
|
+
status?: number;
|
|
100
|
+
code?: string;
|
|
101
|
+
details?: unknown;
|
|
102
|
+
}
|
|
103
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
|
|
104
|
+
interface RequestOptions {
|
|
105
|
+
method: HttpMethod;
|
|
106
|
+
headers?: Record<string, string>;
|
|
107
|
+
body?: unknown;
|
|
108
|
+
timeout?: number;
|
|
109
|
+
}
|
|
110
|
+
interface PostgrestError {
|
|
111
|
+
message: string;
|
|
112
|
+
details?: string;
|
|
113
|
+
hint?: string;
|
|
114
|
+
code?: string;
|
|
115
|
+
}
|
|
116
|
+
interface PostgrestResponse<T> {
|
|
117
|
+
data: T | null;
|
|
118
|
+
error: PostgrestError | null;
|
|
119
|
+
count: number | null;
|
|
120
|
+
status: number;
|
|
121
|
+
statusText: string;
|
|
122
|
+
}
|
|
123
|
+
type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'cs' | 'cd' | 'ov' | 'sl' | 'sr' | 'nxr' | 'nxl' | 'fts' | 'plfts' | 'wfts';
|
|
124
|
+
interface QueryFilter {
|
|
125
|
+
column: string;
|
|
126
|
+
operator: FilterOperator;
|
|
127
|
+
value: unknown;
|
|
128
|
+
}
|
|
129
|
+
type OrderDirection = 'asc' | 'desc';
|
|
130
|
+
interface OrderBy {
|
|
131
|
+
column: string;
|
|
132
|
+
direction: OrderDirection;
|
|
133
|
+
nulls?: 'first' | 'last';
|
|
134
|
+
}
|
|
135
|
+
interface RealtimeMessage {
|
|
136
|
+
type: 'subscribe' | 'unsubscribe' | 'heartbeat' | 'broadcast' | 'ack' | 'error';
|
|
137
|
+
channel?: string;
|
|
138
|
+
event?: string;
|
|
139
|
+
schema?: string;
|
|
140
|
+
table?: string;
|
|
141
|
+
filter?: string;
|
|
142
|
+
payload?: unknown;
|
|
143
|
+
error?: string;
|
|
144
|
+
config?: PostgresChangesConfig;
|
|
145
|
+
}
|
|
146
|
+
interface PostgresChangesConfig {
|
|
147
|
+
event: 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
148
|
+
schema: string;
|
|
149
|
+
table: string;
|
|
150
|
+
filter?: string;
|
|
151
|
+
}
|
|
152
|
+
interface RealtimeChangePayload {
|
|
153
|
+
type: 'INSERT' | 'UPDATE' | 'DELETE';
|
|
154
|
+
schema: string;
|
|
155
|
+
table: string;
|
|
156
|
+
new_record?: Record<string, unknown>;
|
|
157
|
+
old_record?: Record<string, unknown>;
|
|
158
|
+
timestamp: string;
|
|
159
|
+
}
|
|
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>;
|
|
169
|
+
}
|
|
170
|
+
interface UploadOptions {
|
|
171
|
+
contentType?: string;
|
|
172
|
+
metadata?: Record<string, string>;
|
|
173
|
+
cacheControl?: string;
|
|
174
|
+
upsert?: boolean;
|
|
175
|
+
}
|
|
176
|
+
interface ListOptions {
|
|
177
|
+
prefix?: string;
|
|
178
|
+
limit?: number;
|
|
179
|
+
offset?: number;
|
|
180
|
+
}
|
|
181
|
+
interface SignedUrlOptions {
|
|
182
|
+
expiresIn?: number;
|
|
183
|
+
}
|
|
184
|
+
interface PasswordResetResponse {
|
|
185
|
+
message: string;
|
|
186
|
+
}
|
|
187
|
+
interface VerifyResetTokenResponse {
|
|
188
|
+
valid: boolean;
|
|
189
|
+
message: string;
|
|
190
|
+
}
|
|
191
|
+
interface ResetPasswordResponse {
|
|
192
|
+
message: string;
|
|
193
|
+
}
|
|
194
|
+
interface MagicLinkOptions {
|
|
195
|
+
redirect_to?: string;
|
|
196
|
+
}
|
|
197
|
+
interface MagicLinkResponse {
|
|
198
|
+
message: string;
|
|
199
|
+
}
|
|
200
|
+
interface OAuthProvidersResponse {
|
|
201
|
+
providers: OAuthProvider[];
|
|
202
|
+
}
|
|
203
|
+
interface OAuthOptions {
|
|
204
|
+
redirect_to?: string;
|
|
205
|
+
scopes?: string[];
|
|
206
|
+
}
|
|
207
|
+
interface OAuthUrlResponse {
|
|
208
|
+
url: string;
|
|
209
|
+
provider: string;
|
|
210
|
+
}
|
|
211
|
+
interface AdminSetupStatusResponse {
|
|
212
|
+
needs_setup: boolean;
|
|
213
|
+
has_admin: boolean;
|
|
214
|
+
}
|
|
215
|
+
interface AdminSetupRequest {
|
|
216
|
+
email: string;
|
|
217
|
+
password: string;
|
|
218
|
+
name: string;
|
|
219
|
+
}
|
|
220
|
+
interface AdminUser {
|
|
221
|
+
id: string;
|
|
222
|
+
email: string;
|
|
223
|
+
name: string;
|
|
224
|
+
role: string;
|
|
225
|
+
email_verified: boolean;
|
|
226
|
+
created_at: string;
|
|
227
|
+
updated_at: string;
|
|
228
|
+
last_login_at?: string;
|
|
229
|
+
}
|
|
230
|
+
interface AdminAuthResponse {
|
|
231
|
+
user: AdminUser;
|
|
232
|
+
access_token: string;
|
|
233
|
+
refresh_token: string;
|
|
234
|
+
expires_in: number;
|
|
235
|
+
}
|
|
236
|
+
interface AdminLoginRequest {
|
|
237
|
+
email: string;
|
|
238
|
+
password: string;
|
|
239
|
+
}
|
|
240
|
+
interface AdminRefreshRequest {
|
|
241
|
+
refresh_token: string;
|
|
242
|
+
}
|
|
243
|
+
interface AdminRefreshResponse {
|
|
244
|
+
access_token: string;
|
|
245
|
+
refresh_token: string;
|
|
246
|
+
expires_in: number;
|
|
247
|
+
user: AdminUser;
|
|
248
|
+
}
|
|
249
|
+
interface AdminMeResponse {
|
|
250
|
+
user: {
|
|
251
|
+
id: string;
|
|
252
|
+
email: string;
|
|
253
|
+
role: string;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
interface EnrichedUser {
|
|
257
|
+
id: string;
|
|
258
|
+
email: string;
|
|
259
|
+
role?: string;
|
|
260
|
+
created_at: string;
|
|
261
|
+
updated_at?: string;
|
|
262
|
+
email_verified?: boolean;
|
|
263
|
+
last_login_at?: string;
|
|
264
|
+
session_count?: number;
|
|
265
|
+
is_anonymous?: boolean;
|
|
266
|
+
metadata?: Record<string, any>;
|
|
267
|
+
}
|
|
268
|
+
interface ListUsersResponse {
|
|
269
|
+
users: EnrichedUser[];
|
|
270
|
+
total: number;
|
|
271
|
+
}
|
|
272
|
+
interface ListUsersOptions {
|
|
273
|
+
exclude_admins?: boolean;
|
|
274
|
+
search?: string;
|
|
275
|
+
limit?: number;
|
|
276
|
+
type?: 'app' | 'dashboard';
|
|
277
|
+
}
|
|
278
|
+
interface InviteUserRequest {
|
|
279
|
+
email: string;
|
|
280
|
+
role?: string;
|
|
281
|
+
send_email?: boolean;
|
|
282
|
+
}
|
|
283
|
+
interface InviteUserResponse {
|
|
284
|
+
user: EnrichedUser;
|
|
285
|
+
invitation_link?: string;
|
|
286
|
+
message: string;
|
|
287
|
+
}
|
|
288
|
+
interface UpdateUserRoleRequest {
|
|
289
|
+
role: string;
|
|
290
|
+
}
|
|
291
|
+
interface ResetUserPasswordResponse {
|
|
292
|
+
message: string;
|
|
293
|
+
}
|
|
294
|
+
interface DeleteUserResponse {
|
|
295
|
+
message: string;
|
|
296
|
+
}
|
|
297
|
+
interface APIKey {
|
|
298
|
+
id: string;
|
|
299
|
+
name: string;
|
|
300
|
+
description?: string;
|
|
301
|
+
key_prefix: string;
|
|
302
|
+
scopes: string[];
|
|
303
|
+
rate_limit_per_minute: number;
|
|
304
|
+
created_at: string;
|
|
305
|
+
updated_at?: string;
|
|
306
|
+
expires_at?: string;
|
|
307
|
+
revoked_at?: string;
|
|
308
|
+
last_used_at?: string;
|
|
309
|
+
user_id: string;
|
|
310
|
+
}
|
|
311
|
+
interface CreateAPIKeyRequest {
|
|
312
|
+
name: string;
|
|
313
|
+
description?: string;
|
|
314
|
+
scopes: string[];
|
|
315
|
+
rate_limit_per_minute: number;
|
|
316
|
+
expires_at?: string;
|
|
317
|
+
}
|
|
318
|
+
interface CreateAPIKeyResponse {
|
|
319
|
+
api_key: APIKey;
|
|
320
|
+
key: string;
|
|
321
|
+
}
|
|
322
|
+
interface ListAPIKeysResponse {
|
|
323
|
+
api_keys: APIKey[];
|
|
324
|
+
total: number;
|
|
325
|
+
}
|
|
326
|
+
interface UpdateAPIKeyRequest {
|
|
327
|
+
name?: string;
|
|
328
|
+
description?: string;
|
|
329
|
+
scopes?: string[];
|
|
330
|
+
rate_limit_per_minute?: number;
|
|
331
|
+
}
|
|
332
|
+
interface RevokeAPIKeyResponse {
|
|
333
|
+
message: string;
|
|
334
|
+
}
|
|
335
|
+
interface DeleteAPIKeyResponse {
|
|
336
|
+
message: string;
|
|
337
|
+
}
|
|
338
|
+
interface Webhook {
|
|
339
|
+
id: string;
|
|
340
|
+
url: string;
|
|
341
|
+
events: string[];
|
|
342
|
+
secret?: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
is_active: boolean;
|
|
345
|
+
created_at: string;
|
|
346
|
+
updated_at?: string;
|
|
347
|
+
user_id: string;
|
|
348
|
+
}
|
|
349
|
+
interface CreateWebhookRequest {
|
|
350
|
+
url: string;
|
|
351
|
+
events: string[];
|
|
352
|
+
description?: string;
|
|
353
|
+
secret?: string;
|
|
354
|
+
}
|
|
355
|
+
interface UpdateWebhookRequest {
|
|
356
|
+
url?: string;
|
|
357
|
+
events?: string[];
|
|
358
|
+
description?: string;
|
|
359
|
+
is_active?: boolean;
|
|
360
|
+
}
|
|
361
|
+
interface ListWebhooksResponse {
|
|
362
|
+
webhooks: Webhook[];
|
|
363
|
+
total: number;
|
|
364
|
+
}
|
|
365
|
+
interface TestWebhookResponse {
|
|
366
|
+
success: boolean;
|
|
367
|
+
status_code?: number;
|
|
368
|
+
response_body?: string;
|
|
369
|
+
error?: string;
|
|
370
|
+
}
|
|
371
|
+
interface WebhookDelivery {
|
|
372
|
+
id: string;
|
|
373
|
+
webhook_id: string;
|
|
374
|
+
event: string;
|
|
375
|
+
payload: Record<string, any>;
|
|
376
|
+
status_code?: number;
|
|
377
|
+
response_body?: string;
|
|
378
|
+
error?: string;
|
|
379
|
+
created_at: string;
|
|
380
|
+
delivered_at?: string;
|
|
381
|
+
}
|
|
382
|
+
interface ListWebhookDeliveriesResponse {
|
|
383
|
+
deliveries: WebhookDelivery[];
|
|
384
|
+
}
|
|
385
|
+
interface DeleteWebhookResponse {
|
|
386
|
+
message: string;
|
|
387
|
+
}
|
|
388
|
+
interface Invitation {
|
|
389
|
+
id: string;
|
|
390
|
+
email: string;
|
|
391
|
+
role: string;
|
|
392
|
+
token?: string;
|
|
393
|
+
invited_by: string;
|
|
394
|
+
accepted_at?: string;
|
|
395
|
+
expires_at: string;
|
|
396
|
+
created_at: string;
|
|
397
|
+
revoked_at?: string;
|
|
398
|
+
}
|
|
399
|
+
interface CreateInvitationRequest {
|
|
400
|
+
email: string;
|
|
401
|
+
role: 'dashboard_admin' | 'dashboard_user';
|
|
402
|
+
expiry_duration?: number;
|
|
403
|
+
}
|
|
404
|
+
interface CreateInvitationResponse {
|
|
405
|
+
invitation: Invitation;
|
|
406
|
+
invite_link: string;
|
|
407
|
+
email_sent: boolean;
|
|
408
|
+
email_status?: string;
|
|
409
|
+
}
|
|
410
|
+
interface ValidateInvitationResponse {
|
|
411
|
+
valid: boolean;
|
|
412
|
+
invitation?: Invitation;
|
|
413
|
+
error?: string;
|
|
414
|
+
}
|
|
415
|
+
interface AcceptInvitationRequest {
|
|
416
|
+
password: string;
|
|
417
|
+
name: string;
|
|
418
|
+
}
|
|
419
|
+
interface AcceptInvitationResponse {
|
|
420
|
+
user: AdminUser;
|
|
421
|
+
access_token: string;
|
|
422
|
+
refresh_token: string;
|
|
423
|
+
expires_in: number;
|
|
424
|
+
}
|
|
425
|
+
interface ListInvitationsOptions {
|
|
426
|
+
include_accepted?: boolean;
|
|
427
|
+
include_expired?: boolean;
|
|
428
|
+
}
|
|
429
|
+
interface ListInvitationsResponse {
|
|
430
|
+
invitations: Invitation[];
|
|
431
|
+
}
|
|
432
|
+
interface RevokeInvitationResponse {
|
|
433
|
+
message: string;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* System setting with key-value storage
|
|
437
|
+
*/
|
|
438
|
+
interface SystemSetting {
|
|
439
|
+
id: string;
|
|
440
|
+
key: string;
|
|
441
|
+
value: Record<string, unknown>;
|
|
442
|
+
description?: string;
|
|
443
|
+
created_at: string;
|
|
444
|
+
updated_at: string;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Request to update a system setting
|
|
448
|
+
*/
|
|
449
|
+
interface UpdateSystemSettingRequest {
|
|
450
|
+
value: Record<string, unknown>;
|
|
451
|
+
description?: string;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Response containing all system settings
|
|
455
|
+
*/
|
|
456
|
+
interface ListSystemSettingsResponse {
|
|
457
|
+
settings: SystemSetting[];
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Authentication settings for the application
|
|
461
|
+
*/
|
|
462
|
+
interface AuthenticationSettings {
|
|
463
|
+
enable_signup: boolean;
|
|
464
|
+
enable_magic_link: boolean;
|
|
465
|
+
password_min_length: number;
|
|
466
|
+
require_email_verification: boolean;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Feature flags for the application
|
|
470
|
+
*/
|
|
471
|
+
interface FeatureSettings {
|
|
472
|
+
enable_realtime: boolean;
|
|
473
|
+
enable_storage: boolean;
|
|
474
|
+
enable_functions: boolean;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Email configuration settings
|
|
478
|
+
*/
|
|
479
|
+
interface EmailSettings {
|
|
480
|
+
enabled: boolean;
|
|
481
|
+
provider: string;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Security settings for the application
|
|
485
|
+
*/
|
|
486
|
+
interface SecuritySettings {
|
|
487
|
+
enable_global_rate_limit: boolean;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Complete application settings structure
|
|
491
|
+
*/
|
|
492
|
+
interface AppSettings {
|
|
493
|
+
authentication: AuthenticationSettings;
|
|
494
|
+
features: FeatureSettings;
|
|
495
|
+
email: EmailSettings;
|
|
496
|
+
security: SecuritySettings;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Request to update application settings
|
|
500
|
+
* All fields are optional for partial updates
|
|
501
|
+
*/
|
|
502
|
+
interface UpdateAppSettingsRequest {
|
|
503
|
+
authentication?: Partial<AuthenticationSettings>;
|
|
504
|
+
features?: Partial<FeatureSettings>;
|
|
505
|
+
email?: Partial<EmailSettings>;
|
|
506
|
+
security?: Partial<SecuritySettings>;
|
|
507
|
+
}
|
|
508
|
+
interface OAuthProvider {
|
|
509
|
+
id: string;
|
|
510
|
+
name: string;
|
|
511
|
+
enabled: boolean;
|
|
512
|
+
authorize_url?: string;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* OAuth provider configuration
|
|
516
|
+
*/
|
|
517
|
+
interface OAuthProvider {
|
|
518
|
+
id: string;
|
|
519
|
+
provider_name: string;
|
|
520
|
+
display_name: string;
|
|
521
|
+
enabled: boolean;
|
|
522
|
+
client_id: string;
|
|
523
|
+
client_secret?: string;
|
|
524
|
+
redirect_url: string;
|
|
525
|
+
scopes: string[];
|
|
526
|
+
is_custom: boolean;
|
|
527
|
+
authorization_url?: string;
|
|
528
|
+
token_url?: string;
|
|
529
|
+
user_info_url?: string;
|
|
530
|
+
created_at: string;
|
|
531
|
+
updated_at: string;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Request to create a new OAuth provider
|
|
535
|
+
*/
|
|
536
|
+
interface CreateOAuthProviderRequest {
|
|
537
|
+
provider_name: string;
|
|
538
|
+
display_name: string;
|
|
539
|
+
enabled: boolean;
|
|
540
|
+
client_id: string;
|
|
541
|
+
client_secret: string;
|
|
542
|
+
redirect_url: string;
|
|
543
|
+
scopes: string[];
|
|
544
|
+
is_custom: boolean;
|
|
545
|
+
authorization_url?: string;
|
|
546
|
+
token_url?: string;
|
|
547
|
+
user_info_url?: string;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Response after creating an OAuth provider
|
|
551
|
+
*/
|
|
552
|
+
interface CreateOAuthProviderResponse {
|
|
553
|
+
success: boolean;
|
|
554
|
+
id: string;
|
|
555
|
+
provider: string;
|
|
556
|
+
message: string;
|
|
557
|
+
created_at: string;
|
|
558
|
+
updated_at: string;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Request to update an OAuth provider
|
|
562
|
+
*/
|
|
563
|
+
interface UpdateOAuthProviderRequest {
|
|
564
|
+
display_name?: string;
|
|
565
|
+
enabled?: boolean;
|
|
566
|
+
client_id?: string;
|
|
567
|
+
client_secret?: string;
|
|
568
|
+
redirect_url?: string;
|
|
569
|
+
scopes?: string[];
|
|
570
|
+
authorization_url?: string;
|
|
571
|
+
token_url?: string;
|
|
572
|
+
user_info_url?: string;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Response after updating an OAuth provider
|
|
576
|
+
*/
|
|
577
|
+
interface UpdateOAuthProviderResponse {
|
|
578
|
+
success: boolean;
|
|
579
|
+
message: string;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Response after deleting an OAuth provider
|
|
583
|
+
*/
|
|
584
|
+
interface DeleteOAuthProviderResponse {
|
|
585
|
+
success: boolean;
|
|
586
|
+
message: string;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Response for listing OAuth providers
|
|
590
|
+
*/
|
|
591
|
+
interface ListOAuthProvidersResponse {
|
|
592
|
+
providers: OAuthProvider[];
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Authentication settings configuration
|
|
596
|
+
*/
|
|
597
|
+
interface AuthSettings {
|
|
598
|
+
enable_signup: boolean;
|
|
599
|
+
require_email_verification: boolean;
|
|
600
|
+
enable_magic_link: boolean;
|
|
601
|
+
password_min_length: number;
|
|
602
|
+
password_require_uppercase: boolean;
|
|
603
|
+
password_require_lowercase: boolean;
|
|
604
|
+
password_require_number: boolean;
|
|
605
|
+
password_require_special: boolean;
|
|
606
|
+
session_timeout_minutes: number;
|
|
607
|
+
max_sessions_per_user: number;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Request to update authentication settings
|
|
611
|
+
*/
|
|
612
|
+
interface UpdateAuthSettingsRequest {
|
|
613
|
+
enable_signup?: boolean;
|
|
614
|
+
require_email_verification?: boolean;
|
|
615
|
+
enable_magic_link?: boolean;
|
|
616
|
+
password_min_length?: number;
|
|
617
|
+
password_require_uppercase?: boolean;
|
|
618
|
+
password_require_lowercase?: boolean;
|
|
619
|
+
password_require_number?: boolean;
|
|
620
|
+
password_require_special?: boolean;
|
|
621
|
+
session_timeout_minutes?: number;
|
|
622
|
+
max_sessions_per_user?: number;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Response after updating authentication settings
|
|
626
|
+
*/
|
|
627
|
+
interface UpdateAuthSettingsResponse {
|
|
628
|
+
success: boolean;
|
|
629
|
+
message: string;
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Column definition for creating a table
|
|
633
|
+
*/
|
|
634
|
+
interface CreateColumnRequest {
|
|
635
|
+
name: string;
|
|
636
|
+
type: string;
|
|
637
|
+
nullable?: boolean;
|
|
638
|
+
primaryKey?: boolean;
|
|
639
|
+
defaultValue?: string;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Request to create a new database schema
|
|
643
|
+
*/
|
|
644
|
+
interface CreateSchemaRequest {
|
|
645
|
+
name: string;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Response after creating a schema
|
|
649
|
+
*/
|
|
650
|
+
interface CreateSchemaResponse {
|
|
651
|
+
message: string;
|
|
652
|
+
schema: string;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Request to create a new table
|
|
656
|
+
*/
|
|
657
|
+
interface CreateTableRequest {
|
|
658
|
+
schema: string;
|
|
659
|
+
name: string;
|
|
660
|
+
columns: CreateColumnRequest[];
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Response after creating a table
|
|
664
|
+
*/
|
|
665
|
+
interface CreateTableResponse {
|
|
666
|
+
message: string;
|
|
667
|
+
schema: string;
|
|
668
|
+
table: string;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Response after deleting a table
|
|
672
|
+
*/
|
|
673
|
+
interface DeleteTableResponse {
|
|
674
|
+
message: string;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Database schema information
|
|
678
|
+
*/
|
|
679
|
+
interface Schema {
|
|
680
|
+
name: string;
|
|
681
|
+
owner?: string;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Response for listing schemas
|
|
685
|
+
*/
|
|
686
|
+
interface ListSchemasResponse {
|
|
687
|
+
schemas: Schema[];
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Table column information
|
|
691
|
+
*/
|
|
692
|
+
interface Column {
|
|
693
|
+
name: string;
|
|
694
|
+
type: string;
|
|
695
|
+
nullable: boolean;
|
|
696
|
+
default_value?: string;
|
|
697
|
+
is_primary_key?: boolean;
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Database table information
|
|
701
|
+
*/
|
|
702
|
+
interface Table {
|
|
703
|
+
schema: string;
|
|
704
|
+
name: string;
|
|
705
|
+
columns?: Column[];
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Response for listing tables
|
|
709
|
+
*/
|
|
710
|
+
interface ListTablesResponse {
|
|
711
|
+
tables: Table[];
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Impersonation type
|
|
715
|
+
*/
|
|
716
|
+
type ImpersonationType = 'user' | 'anon' | 'service';
|
|
717
|
+
/**
|
|
718
|
+
* Target user information for impersonation
|
|
719
|
+
*/
|
|
720
|
+
interface ImpersonationTargetUser {
|
|
721
|
+
id: string;
|
|
722
|
+
email: string;
|
|
723
|
+
role: string;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Impersonation session information
|
|
727
|
+
*/
|
|
728
|
+
interface ImpersonationSession {
|
|
729
|
+
id: string;
|
|
730
|
+
admin_user_id: string;
|
|
731
|
+
target_user_id: string | null;
|
|
732
|
+
impersonation_type: ImpersonationType;
|
|
733
|
+
target_role: string;
|
|
734
|
+
reason: string;
|
|
735
|
+
started_at: string;
|
|
736
|
+
ended_at: string | null;
|
|
737
|
+
is_active: boolean;
|
|
738
|
+
ip_address: string | null;
|
|
739
|
+
user_agent: string | null;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Request to start impersonating a specific user
|
|
743
|
+
*/
|
|
744
|
+
interface ImpersonateUserRequest {
|
|
745
|
+
target_user_id: string;
|
|
746
|
+
reason: string;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Request to start impersonating as anonymous user
|
|
750
|
+
*/
|
|
751
|
+
interface ImpersonateAnonRequest {
|
|
752
|
+
reason: string;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Request to start impersonating with service role
|
|
756
|
+
*/
|
|
757
|
+
interface ImpersonateServiceRequest {
|
|
758
|
+
reason: string;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Response after starting impersonation
|
|
762
|
+
*/
|
|
763
|
+
interface StartImpersonationResponse {
|
|
764
|
+
session: ImpersonationSession;
|
|
765
|
+
target_user: ImpersonationTargetUser | null;
|
|
766
|
+
access_token: string;
|
|
767
|
+
refresh_token: string;
|
|
768
|
+
expires_in: number;
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Response after stopping impersonation
|
|
772
|
+
*/
|
|
773
|
+
interface StopImpersonationResponse {
|
|
774
|
+
success: boolean;
|
|
775
|
+
message: string;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* Response for getting current impersonation session
|
|
779
|
+
*/
|
|
780
|
+
interface GetImpersonationResponse {
|
|
781
|
+
session: ImpersonationSession | null;
|
|
782
|
+
target_user: ImpersonationTargetUser | null;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Options for listing impersonation sessions
|
|
786
|
+
*/
|
|
787
|
+
interface ListImpersonationSessionsOptions {
|
|
788
|
+
limit?: number;
|
|
789
|
+
offset?: number;
|
|
790
|
+
admin_user_id?: string;
|
|
791
|
+
target_user_id?: string;
|
|
792
|
+
impersonation_type?: ImpersonationType;
|
|
793
|
+
is_active?: boolean;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Response for listing impersonation sessions
|
|
797
|
+
*/
|
|
798
|
+
interface ListImpersonationSessionsResponse {
|
|
799
|
+
sessions: ImpersonationSession[];
|
|
800
|
+
total: number;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Auth state change events
|
|
804
|
+
*/
|
|
805
|
+
type AuthChangeEvent = 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED' | 'USER_UPDATED' | 'PASSWORD_RECOVERY' | 'MFA_CHALLENGE_VERIFIED';
|
|
806
|
+
/**
|
|
807
|
+
* Callback for auth state changes
|
|
808
|
+
*/
|
|
809
|
+
type AuthStateChangeCallback = (event: AuthChangeEvent, session: AuthSession | null) => void;
|
|
810
|
+
/**
|
|
811
|
+
* Subscription object returned by onAuthStateChange
|
|
812
|
+
*/
|
|
813
|
+
interface AuthSubscription {
|
|
814
|
+
/**
|
|
815
|
+
* Unsubscribe from auth state changes
|
|
816
|
+
*/
|
|
817
|
+
unsubscribe: () => void;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* HTTP client for making requests to the Fluxbase API
|
|
822
|
+
*/
|
|
823
|
+
|
|
824
|
+
interface FetchOptions {
|
|
825
|
+
method: HttpMethod;
|
|
826
|
+
headers?: Record<string, string>;
|
|
827
|
+
body?: unknown;
|
|
828
|
+
timeout?: number;
|
|
829
|
+
}
|
|
830
|
+
declare class FluxbaseFetch {
|
|
831
|
+
private baseUrl;
|
|
832
|
+
private defaultHeaders;
|
|
833
|
+
private timeout;
|
|
834
|
+
private debug;
|
|
835
|
+
constructor(baseUrl: string, options?: {
|
|
836
|
+
headers?: Record<string, string>;
|
|
837
|
+
timeout?: number;
|
|
838
|
+
debug?: boolean;
|
|
839
|
+
});
|
|
840
|
+
/**
|
|
841
|
+
* Update the authorization header
|
|
842
|
+
*/
|
|
843
|
+
setAuthToken(token: string | null): void;
|
|
844
|
+
/**
|
|
845
|
+
* Make an HTTP request
|
|
846
|
+
*/
|
|
847
|
+
request<T = unknown>(path: string, options: FetchOptions): Promise<T>;
|
|
848
|
+
/**
|
|
849
|
+
* GET request
|
|
850
|
+
*/
|
|
851
|
+
get<T = unknown>(path: string, options?: Omit<FetchOptions, 'method'>): Promise<T>;
|
|
852
|
+
/**
|
|
853
|
+
* POST request
|
|
854
|
+
*/
|
|
855
|
+
post<T = unknown>(path: string, body?: unknown, options?: Omit<FetchOptions, 'method' | 'body'>): Promise<T>;
|
|
856
|
+
/**
|
|
857
|
+
* PUT request
|
|
858
|
+
*/
|
|
859
|
+
put<T = unknown>(path: string, body?: unknown, options?: Omit<FetchOptions, 'method' | 'body'>): Promise<T>;
|
|
860
|
+
/**
|
|
861
|
+
* PATCH request
|
|
862
|
+
*/
|
|
863
|
+
patch<T = unknown>(path: string, body?: unknown, options?: Omit<FetchOptions, 'method' | 'body'>): Promise<T>;
|
|
864
|
+
/**
|
|
865
|
+
* DELETE request
|
|
866
|
+
*/
|
|
867
|
+
delete<T = unknown>(path: string, options?: Omit<FetchOptions, 'method'>): Promise<T>;
|
|
868
|
+
/**
|
|
869
|
+
* HEAD request
|
|
870
|
+
*/
|
|
871
|
+
head(path: string, options?: Omit<FetchOptions, 'method'>): Promise<Headers>;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Authentication module for Fluxbase SDK
|
|
876
|
+
*/
|
|
877
|
+
|
|
878
|
+
declare class FluxbaseAuth {
|
|
879
|
+
private fetch;
|
|
880
|
+
private session;
|
|
881
|
+
private persist;
|
|
882
|
+
private autoRefresh;
|
|
883
|
+
private refreshTimer;
|
|
884
|
+
private stateChangeListeners;
|
|
885
|
+
constructor(fetch: FluxbaseFetch, autoRefresh?: boolean, persist?: boolean);
|
|
886
|
+
/**
|
|
887
|
+
* Get the current session
|
|
888
|
+
*/
|
|
889
|
+
getSession(): AuthSession | null;
|
|
890
|
+
/**
|
|
891
|
+
* Get the current user
|
|
892
|
+
*/
|
|
893
|
+
getUser(): User | null;
|
|
894
|
+
/**
|
|
895
|
+
* Get the current access token
|
|
896
|
+
*/
|
|
897
|
+
getAccessToken(): string | null;
|
|
898
|
+
/**
|
|
899
|
+
* Listen to auth state changes
|
|
900
|
+
* @param callback - Function called when auth state changes
|
|
901
|
+
* @returns Subscription object with unsubscribe method
|
|
902
|
+
*
|
|
903
|
+
* @example
|
|
904
|
+
* ```typescript
|
|
905
|
+
* const { data: { subscription } } = client.auth.onAuthStateChange((event, session) => {
|
|
906
|
+
* console.log('Auth event:', event, session)
|
|
907
|
+
* })
|
|
908
|
+
*
|
|
909
|
+
* // Later, to unsubscribe:
|
|
910
|
+
* subscription.unsubscribe()
|
|
911
|
+
* ```
|
|
912
|
+
*/
|
|
913
|
+
onAuthStateChange(callback: AuthStateChangeCallback): AuthSubscription;
|
|
914
|
+
/**
|
|
915
|
+
* Sign in with email and password
|
|
916
|
+
* Returns AuthSession if successful, or SignInWith2FAResponse if 2FA is required
|
|
917
|
+
*/
|
|
918
|
+
signIn(credentials: SignInCredentials): Promise<AuthSession | SignInWith2FAResponse>;
|
|
919
|
+
/**
|
|
920
|
+
* Sign up with email and password
|
|
921
|
+
*/
|
|
922
|
+
signUp(credentials: SignUpCredentials): Promise<AuthSession>;
|
|
923
|
+
/**
|
|
924
|
+
* Sign out the current user
|
|
925
|
+
*/
|
|
926
|
+
signOut(): Promise<void>;
|
|
927
|
+
/**
|
|
928
|
+
* Refresh the access token
|
|
929
|
+
*/
|
|
930
|
+
refreshToken(): Promise<AuthSession>;
|
|
931
|
+
/**
|
|
932
|
+
* Get the current user from the server
|
|
933
|
+
*/
|
|
934
|
+
getCurrentUser(): Promise<User>;
|
|
935
|
+
/**
|
|
936
|
+
* Update the current user
|
|
937
|
+
*/
|
|
938
|
+
updateUser(data: Partial<Pick<User, 'email' | 'metadata'>>): Promise<User>;
|
|
939
|
+
/**
|
|
940
|
+
* Set the auth token manually
|
|
941
|
+
*/
|
|
942
|
+
setToken(token: string): void;
|
|
943
|
+
/**
|
|
944
|
+
* Setup 2FA for the current user
|
|
945
|
+
* Returns TOTP secret and QR code URL
|
|
946
|
+
*/
|
|
947
|
+
setup2FA(): Promise<TwoFactorSetupResponse>;
|
|
948
|
+
/**
|
|
949
|
+
* Enable 2FA after verifying the TOTP code
|
|
950
|
+
* Returns backup codes that should be saved by the user
|
|
951
|
+
*/
|
|
952
|
+
enable2FA(code: string): Promise<TwoFactorEnableResponse>;
|
|
953
|
+
/**
|
|
954
|
+
* Disable 2FA for the current user
|
|
955
|
+
* Requires password confirmation
|
|
956
|
+
*/
|
|
957
|
+
disable2FA(password: string): Promise<{
|
|
958
|
+
success: boolean;
|
|
959
|
+
message: string;
|
|
960
|
+
}>;
|
|
961
|
+
/**
|
|
962
|
+
* Check 2FA status for the current user
|
|
963
|
+
*/
|
|
964
|
+
get2FAStatus(): Promise<TwoFactorStatusResponse>;
|
|
965
|
+
/**
|
|
966
|
+
* Verify 2FA code during login
|
|
967
|
+
* Call this after signIn returns requires_2fa: true
|
|
968
|
+
*/
|
|
969
|
+
verify2FA(request: TwoFactorVerifyRequest): Promise<AuthSession>;
|
|
970
|
+
/**
|
|
971
|
+
* Send password reset email
|
|
972
|
+
* Sends a password reset link to the provided email address
|
|
973
|
+
* @param email - Email address to send reset link to
|
|
974
|
+
*/
|
|
975
|
+
sendPasswordReset(email: string): Promise<PasswordResetResponse>;
|
|
976
|
+
/**
|
|
977
|
+
* Verify password reset token
|
|
978
|
+
* Check if a password reset token is valid before allowing password reset
|
|
979
|
+
* @param token - Password reset token to verify
|
|
980
|
+
*/
|
|
981
|
+
verifyResetToken(token: string): Promise<VerifyResetTokenResponse>;
|
|
982
|
+
/**
|
|
983
|
+
* Reset password with token
|
|
984
|
+
* Complete the password reset process with a valid token
|
|
985
|
+
* @param token - Password reset token
|
|
986
|
+
* @param newPassword - New password to set
|
|
987
|
+
*/
|
|
988
|
+
resetPassword(token: string, newPassword: string): Promise<ResetPasswordResponse>;
|
|
989
|
+
/**
|
|
990
|
+
* Send magic link for passwordless authentication
|
|
991
|
+
* @param email - Email address to send magic link to
|
|
992
|
+
* @param options - Optional configuration for magic link
|
|
993
|
+
*/
|
|
994
|
+
sendMagicLink(email: string, options?: MagicLinkOptions): Promise<MagicLinkResponse>;
|
|
995
|
+
/**
|
|
996
|
+
* Verify magic link token and sign in
|
|
997
|
+
* @param token - Magic link token from email
|
|
998
|
+
*/
|
|
999
|
+
verifyMagicLink(token: string): Promise<AuthSession>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Sign in anonymously
|
|
1002
|
+
* Creates a temporary anonymous user session
|
|
1003
|
+
*/
|
|
1004
|
+
signInAnonymously(): Promise<AuthSession>;
|
|
1005
|
+
/**
|
|
1006
|
+
* Get list of enabled OAuth providers
|
|
1007
|
+
*/
|
|
1008
|
+
getOAuthProviders(): Promise<OAuthProvidersResponse>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Get OAuth authorization URL for a provider
|
|
1011
|
+
* @param provider - OAuth provider name (e.g., 'google', 'github')
|
|
1012
|
+
* @param options - Optional OAuth configuration
|
|
1013
|
+
*/
|
|
1014
|
+
getOAuthUrl(provider: string, options?: OAuthOptions): Promise<OAuthUrlResponse>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Exchange OAuth authorization code for session
|
|
1017
|
+
* This is typically called in your OAuth callback handler
|
|
1018
|
+
* @param code - Authorization code from OAuth callback
|
|
1019
|
+
*/
|
|
1020
|
+
exchangeCodeForSession(code: string): Promise<AuthSession>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Convenience method to initiate OAuth sign-in
|
|
1023
|
+
* Redirects the user to the OAuth provider's authorization page
|
|
1024
|
+
* @param provider - OAuth provider name (e.g., 'google', 'github')
|
|
1025
|
+
* @param options - Optional OAuth configuration
|
|
1026
|
+
*/
|
|
1027
|
+
signInWithOAuth(provider: string, options?: OAuthOptions): Promise<void>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Internal: Set the session and persist it
|
|
1030
|
+
*/
|
|
1031
|
+
private setSession;
|
|
1032
|
+
/**
|
|
1033
|
+
* Internal: Clear the session
|
|
1034
|
+
*/
|
|
1035
|
+
private clearSession;
|
|
1036
|
+
/**
|
|
1037
|
+
* Internal: Save session to storage
|
|
1038
|
+
*/
|
|
1039
|
+
private saveSession;
|
|
1040
|
+
/**
|
|
1041
|
+
* Internal: Schedule automatic token refresh
|
|
1042
|
+
*/
|
|
1043
|
+
private scheduleTokenRefresh;
|
|
1044
|
+
/**
|
|
1045
|
+
* Internal: Emit auth state change event to all listeners
|
|
1046
|
+
*/
|
|
1047
|
+
private emitAuthChange;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Realtime subscriptions using WebSockets
|
|
1052
|
+
*/
|
|
1053
|
+
|
|
1054
|
+
declare class RealtimeChannel {
|
|
1055
|
+
private ws;
|
|
1056
|
+
private url;
|
|
1057
|
+
private token;
|
|
1058
|
+
private channelName;
|
|
1059
|
+
private callbacks;
|
|
1060
|
+
private subscriptionConfig;
|
|
1061
|
+
private reconnectAttempts;
|
|
1062
|
+
private maxReconnectAttempts;
|
|
1063
|
+
private reconnectDelay;
|
|
1064
|
+
private heartbeatInterval;
|
|
1065
|
+
constructor(url: string, channelName: string, token?: string | null);
|
|
1066
|
+
/**
|
|
1067
|
+
* Listen to postgres_changes with optional row-level filtering
|
|
1068
|
+
*
|
|
1069
|
+
* @param event - 'postgres_changes'
|
|
1070
|
+
* @param config - Configuration including optional filter
|
|
1071
|
+
* @param callback - Function to call when changes occur
|
|
1072
|
+
* @returns This channel for chaining
|
|
1073
|
+
*
|
|
1074
|
+
* @example
|
|
1075
|
+
* ```typescript
|
|
1076
|
+
* channel.on('postgres_changes', {
|
|
1077
|
+
* event: '*',
|
|
1078
|
+
* schema: 'public',
|
|
1079
|
+
* table: 'jobs',
|
|
1080
|
+
* filter: 'created_by=eq.user123'
|
|
1081
|
+
* }, (payload) => {
|
|
1082
|
+
* console.log('Job updated:', payload)
|
|
1083
|
+
* })
|
|
1084
|
+
* ```
|
|
1085
|
+
*/
|
|
1086
|
+
on(event: 'postgres_changes', config: PostgresChangesConfig, callback: RealtimeCallback): this;
|
|
1087
|
+
/**
|
|
1088
|
+
* Listen to a specific event type (backwards compatibility)
|
|
1089
|
+
*
|
|
1090
|
+
* @param event - The event type (INSERT, UPDATE, DELETE, or '*' for all)
|
|
1091
|
+
* @param callback - The callback function
|
|
1092
|
+
* @returns This channel for chaining
|
|
1093
|
+
*
|
|
1094
|
+
* @example
|
|
1095
|
+
* ```typescript
|
|
1096
|
+
* channel.on('INSERT', (payload) => {
|
|
1097
|
+
* console.log('New record inserted:', payload.new_record)
|
|
1098
|
+
* })
|
|
1099
|
+
* ```
|
|
1100
|
+
*/
|
|
1101
|
+
on(event: 'INSERT' | 'UPDATE' | 'DELETE' | '*', callback: RealtimeCallback): this;
|
|
1102
|
+
/**
|
|
1103
|
+
* Remove a callback
|
|
1104
|
+
*/
|
|
1105
|
+
off(event: 'INSERT' | 'UPDATE' | 'DELETE' | '*', callback: RealtimeCallback): this;
|
|
1106
|
+
/**
|
|
1107
|
+
* Subscribe to the channel
|
|
1108
|
+
*/
|
|
1109
|
+
subscribe(): this;
|
|
1110
|
+
/**
|
|
1111
|
+
* Unsubscribe from the channel
|
|
1112
|
+
*/
|
|
1113
|
+
unsubscribe(): void;
|
|
1114
|
+
/**
|
|
1115
|
+
* Internal: Connect to WebSocket
|
|
1116
|
+
*/
|
|
1117
|
+
private connect;
|
|
1118
|
+
/**
|
|
1119
|
+
* Internal: Disconnect WebSocket
|
|
1120
|
+
*/
|
|
1121
|
+
private disconnect;
|
|
1122
|
+
/**
|
|
1123
|
+
* Internal: Send a message
|
|
1124
|
+
*/
|
|
1125
|
+
private send;
|
|
1126
|
+
/**
|
|
1127
|
+
* Internal: Handle incoming message
|
|
1128
|
+
*/
|
|
1129
|
+
private handleMessage;
|
|
1130
|
+
/**
|
|
1131
|
+
* Internal: Handle broadcast message
|
|
1132
|
+
*/
|
|
1133
|
+
private handleBroadcast;
|
|
1134
|
+
/**
|
|
1135
|
+
* Internal: Start heartbeat interval
|
|
1136
|
+
*/
|
|
1137
|
+
private startHeartbeat;
|
|
1138
|
+
/**
|
|
1139
|
+
* Internal: Stop heartbeat interval
|
|
1140
|
+
*/
|
|
1141
|
+
private stopHeartbeat;
|
|
1142
|
+
/**
|
|
1143
|
+
* Internal: Attempt to reconnect
|
|
1144
|
+
*/
|
|
1145
|
+
private attemptReconnect;
|
|
1146
|
+
}
|
|
1147
|
+
declare class FluxbaseRealtime {
|
|
1148
|
+
private url;
|
|
1149
|
+
private token;
|
|
1150
|
+
private channels;
|
|
1151
|
+
constructor(url: string, token?: string | null);
|
|
1152
|
+
/**
|
|
1153
|
+
* Create or get a channel
|
|
1154
|
+
* @param channelName - Channel name (e.g., 'table:public.products')
|
|
1155
|
+
*/
|
|
1156
|
+
channel(channelName: string): RealtimeChannel;
|
|
1157
|
+
/**
|
|
1158
|
+
* Remove all channels
|
|
1159
|
+
*/
|
|
1160
|
+
removeAllChannels(): void;
|
|
1161
|
+
/**
|
|
1162
|
+
* Update auth token for all channels
|
|
1163
|
+
*/
|
|
1164
|
+
setToken(token: string | null): void;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Storage client for file operations
|
|
1169
|
+
*/
|
|
1170
|
+
|
|
1171
|
+
declare class StorageBucket {
|
|
1172
|
+
private fetch;
|
|
1173
|
+
private bucketName;
|
|
1174
|
+
constructor(fetch: FluxbaseFetch, bucketName: string);
|
|
1175
|
+
/**
|
|
1176
|
+
* Upload a file to the bucket
|
|
1177
|
+
* @param path - The path/key for the file
|
|
1178
|
+
* @param file - The file to upload (File, Blob, or ArrayBuffer)
|
|
1179
|
+
* @param options - Upload options
|
|
1180
|
+
*/
|
|
1181
|
+
upload(path: string, file: File | Blob | ArrayBuffer, options?: UploadOptions): Promise<{
|
|
1182
|
+
data: StorageObject | null;
|
|
1183
|
+
error: Error | null;
|
|
1184
|
+
}>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Download a file from the bucket
|
|
1187
|
+
* @param path - The path/key of the file
|
|
1188
|
+
*/
|
|
1189
|
+
download(path: string): Promise<{
|
|
1190
|
+
data: Blob | null;
|
|
1191
|
+
error: Error | null;
|
|
1192
|
+
}>;
|
|
1193
|
+
/**
|
|
1194
|
+
* List files in the bucket
|
|
1195
|
+
* @param options - List options (prefix, limit, offset)
|
|
1196
|
+
*/
|
|
1197
|
+
list(options?: ListOptions): Promise<{
|
|
1198
|
+
data: StorageObject[] | null;
|
|
1199
|
+
error: Error | null;
|
|
1200
|
+
}>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Remove files from the bucket
|
|
1203
|
+
* @param paths - Array of file paths to remove
|
|
1204
|
+
*/
|
|
1205
|
+
remove(paths: string[]): Promise<{
|
|
1206
|
+
data: null;
|
|
1207
|
+
error: Error | null;
|
|
1208
|
+
}>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Get a public URL for a file
|
|
1211
|
+
* @param path - The file path
|
|
1212
|
+
*/
|
|
1213
|
+
getPublicUrl(path: string): {
|
|
1214
|
+
data: {
|
|
1215
|
+
publicUrl: string;
|
|
1216
|
+
};
|
|
1217
|
+
};
|
|
1218
|
+
/**
|
|
1219
|
+
* Create a signed URL for temporary access to a file
|
|
1220
|
+
* @param path - The file path
|
|
1221
|
+
* @param options - Signed URL options
|
|
1222
|
+
*/
|
|
1223
|
+
createSignedUrl(path: string, options?: SignedUrlOptions): Promise<{
|
|
1224
|
+
data: {
|
|
1225
|
+
signedUrl: string;
|
|
1226
|
+
} | null;
|
|
1227
|
+
error: Error | null;
|
|
1228
|
+
}>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Move a file to a new location
|
|
1231
|
+
* @param fromPath - Current file path
|
|
1232
|
+
* @param toPath - New file path
|
|
1233
|
+
*/
|
|
1234
|
+
move(fromPath: string, toPath: string): Promise<{
|
|
1235
|
+
data: StorageObject | null;
|
|
1236
|
+
error: Error | null;
|
|
1237
|
+
}>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Copy a file to a new location
|
|
1240
|
+
* @param fromPath - Source file path
|
|
1241
|
+
* @param toPath - Destination file path
|
|
1242
|
+
*/
|
|
1243
|
+
copy(fromPath: string, toPath: string): Promise<{
|
|
1244
|
+
data: StorageObject | null;
|
|
1245
|
+
error: Error | null;
|
|
1246
|
+
}>;
|
|
1247
|
+
}
|
|
1248
|
+
declare class FluxbaseStorage {
|
|
1249
|
+
private fetch;
|
|
1250
|
+
constructor(fetch: FluxbaseFetch);
|
|
1251
|
+
/**
|
|
1252
|
+
* Get a reference to a storage bucket
|
|
1253
|
+
* @param bucketName - The name of the bucket
|
|
1254
|
+
*/
|
|
1255
|
+
from(bucketName: string): StorageBucket;
|
|
1256
|
+
/**
|
|
1257
|
+
* List all buckets
|
|
1258
|
+
*/
|
|
1259
|
+
listBuckets(): Promise<{
|
|
1260
|
+
data: Array<{
|
|
1261
|
+
name: string;
|
|
1262
|
+
created_at: string;
|
|
1263
|
+
}> | null;
|
|
1264
|
+
error: Error | null;
|
|
1265
|
+
}>;
|
|
1266
|
+
/**
|
|
1267
|
+
* Create a new bucket
|
|
1268
|
+
* @param bucketName - The name of the bucket to create
|
|
1269
|
+
*/
|
|
1270
|
+
createBucket(bucketName: string): Promise<{
|
|
1271
|
+
data: null;
|
|
1272
|
+
error: Error | null;
|
|
1273
|
+
}>;
|
|
1274
|
+
/**
|
|
1275
|
+
* Delete a bucket
|
|
1276
|
+
* @param bucketName - The name of the bucket to delete
|
|
1277
|
+
*/
|
|
1278
|
+
deleteBucket(bucketName: string): Promise<{
|
|
1279
|
+
data: null;
|
|
1280
|
+
error: Error | null;
|
|
1281
|
+
}>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Empty a bucket (delete all files)
|
|
1284
|
+
* @param bucketName - The name of the bucket to empty
|
|
1285
|
+
*/
|
|
1286
|
+
emptyBucket(bucketName: string): Promise<{
|
|
1287
|
+
data: null;
|
|
1288
|
+
error: Error | null;
|
|
1289
|
+
}>;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* System Settings Manager
|
|
1294
|
+
*
|
|
1295
|
+
* Manages low-level system settings with key-value storage.
|
|
1296
|
+
* For application-level settings, use AppSettingsManager instead.
|
|
1297
|
+
*
|
|
1298
|
+
* @example
|
|
1299
|
+
* ```typescript
|
|
1300
|
+
* const settings = client.admin.settings.system
|
|
1301
|
+
*
|
|
1302
|
+
* // List all system settings
|
|
1303
|
+
* const { settings } = await settings.list()
|
|
1304
|
+
*
|
|
1305
|
+
* // Get specific setting
|
|
1306
|
+
* const setting = await settings.get('app.auth.enable_signup')
|
|
1307
|
+
*
|
|
1308
|
+
* // Update setting
|
|
1309
|
+
* await settings.update('app.auth.enable_signup', {
|
|
1310
|
+
* value: { value: true },
|
|
1311
|
+
* description: 'Enable user signup'
|
|
1312
|
+
* })
|
|
1313
|
+
*
|
|
1314
|
+
* // Delete setting
|
|
1315
|
+
* await settings.delete('app.auth.enable_signup')
|
|
1316
|
+
* ```
|
|
1317
|
+
*/
|
|
1318
|
+
declare class SystemSettingsManager {
|
|
1319
|
+
private fetch;
|
|
1320
|
+
constructor(fetch: FluxbaseFetch);
|
|
1321
|
+
/**
|
|
1322
|
+
* List all system settings
|
|
1323
|
+
*
|
|
1324
|
+
* @returns Promise resolving to ListSystemSettingsResponse
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* const response = await client.admin.settings.system.list()
|
|
1329
|
+
* console.log(response.settings)
|
|
1330
|
+
* ```
|
|
1331
|
+
*/
|
|
1332
|
+
list(): Promise<ListSystemSettingsResponse>;
|
|
1333
|
+
/**
|
|
1334
|
+
* Get a specific system setting by key
|
|
1335
|
+
*
|
|
1336
|
+
* @param key - Setting key (e.g., 'app.auth.enable_signup')
|
|
1337
|
+
* @returns Promise resolving to SystemSetting
|
|
1338
|
+
*
|
|
1339
|
+
* @example
|
|
1340
|
+
* ```typescript
|
|
1341
|
+
* const setting = await client.admin.settings.system.get('app.auth.enable_signup')
|
|
1342
|
+
* console.log(setting.value)
|
|
1343
|
+
* ```
|
|
1344
|
+
*/
|
|
1345
|
+
get(key: string): Promise<SystemSetting>;
|
|
1346
|
+
/**
|
|
1347
|
+
* Update or create a system setting
|
|
1348
|
+
*
|
|
1349
|
+
* @param key - Setting key
|
|
1350
|
+
* @param request - Update request with value and optional description
|
|
1351
|
+
* @returns Promise resolving to SystemSetting
|
|
1352
|
+
*
|
|
1353
|
+
* @example
|
|
1354
|
+
* ```typescript
|
|
1355
|
+
* const updated = await client.admin.settings.system.update('app.auth.enable_signup', {
|
|
1356
|
+
* value: { value: true },
|
|
1357
|
+
* description: 'Enable user signup'
|
|
1358
|
+
* })
|
|
1359
|
+
* ```
|
|
1360
|
+
*/
|
|
1361
|
+
update(key: string, request: UpdateSystemSettingRequest): Promise<SystemSetting>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Delete a system setting
|
|
1364
|
+
*
|
|
1365
|
+
* @param key - Setting key to delete
|
|
1366
|
+
* @returns Promise<void>
|
|
1367
|
+
*
|
|
1368
|
+
* @example
|
|
1369
|
+
* ```typescript
|
|
1370
|
+
* await client.admin.settings.system.delete('app.auth.enable_signup')
|
|
1371
|
+
* ```
|
|
1372
|
+
*/
|
|
1373
|
+
delete(key: string): Promise<void>;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Application Settings Manager
|
|
1377
|
+
*
|
|
1378
|
+
* Manages high-level application settings with a structured API.
|
|
1379
|
+
* Provides type-safe access to authentication, features, email, and security settings.
|
|
1380
|
+
*
|
|
1381
|
+
* @example
|
|
1382
|
+
* ```typescript
|
|
1383
|
+
* const settings = client.admin.settings.app
|
|
1384
|
+
*
|
|
1385
|
+
* // Get all app settings
|
|
1386
|
+
* const appSettings = await settings.get()
|
|
1387
|
+
* console.log(appSettings.authentication.enable_signup)
|
|
1388
|
+
*
|
|
1389
|
+
* // Update specific settings
|
|
1390
|
+
* const updated = await settings.update({
|
|
1391
|
+
* authentication: {
|
|
1392
|
+
* enable_signup: true,
|
|
1393
|
+
* password_min_length: 12
|
|
1394
|
+
* }
|
|
1395
|
+
* })
|
|
1396
|
+
*
|
|
1397
|
+
* // Reset to defaults
|
|
1398
|
+
* await settings.reset()
|
|
1399
|
+
* ```
|
|
1400
|
+
*/
|
|
1401
|
+
declare class AppSettingsManager {
|
|
1402
|
+
private fetch;
|
|
1403
|
+
constructor(fetch: FluxbaseFetch);
|
|
1404
|
+
/**
|
|
1405
|
+
* Get all application settings
|
|
1406
|
+
*
|
|
1407
|
+
* Returns structured settings for authentication, features, email, and security.
|
|
1408
|
+
*
|
|
1409
|
+
* @returns Promise resolving to AppSettings
|
|
1410
|
+
*
|
|
1411
|
+
* @example
|
|
1412
|
+
* ```typescript
|
|
1413
|
+
* const settings = await client.admin.settings.app.get()
|
|
1414
|
+
*
|
|
1415
|
+
* console.log('Signup enabled:', settings.authentication.enable_signup)
|
|
1416
|
+
* console.log('Realtime enabled:', settings.features.enable_realtime)
|
|
1417
|
+
* console.log('Email provider:', settings.email.provider)
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
get(): Promise<AppSettings>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Update application settings
|
|
1423
|
+
*
|
|
1424
|
+
* Supports partial updates - only provide the fields you want to change.
|
|
1425
|
+
*
|
|
1426
|
+
* @param request - Settings to update (partial update supported)
|
|
1427
|
+
* @returns Promise resolving to AppSettings - Updated settings
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```typescript
|
|
1431
|
+
* // Update authentication settings
|
|
1432
|
+
* const updated = await client.admin.settings.app.update({
|
|
1433
|
+
* authentication: {
|
|
1434
|
+
* enable_signup: true,
|
|
1435
|
+
* password_min_length: 12
|
|
1436
|
+
* }
|
|
1437
|
+
* })
|
|
1438
|
+
*
|
|
1439
|
+
* // Update multiple categories
|
|
1440
|
+
* await client.admin.settings.app.update({
|
|
1441
|
+
* authentication: { enable_signup: false },
|
|
1442
|
+
* features: { enable_realtime: true },
|
|
1443
|
+
* security: { enable_global_rate_limit: true }
|
|
1444
|
+
* })
|
|
1445
|
+
* ```
|
|
1446
|
+
*/
|
|
1447
|
+
update(request: UpdateAppSettingsRequest): Promise<AppSettings>;
|
|
1448
|
+
/**
|
|
1449
|
+
* Reset all application settings to defaults
|
|
1450
|
+
*
|
|
1451
|
+
* This will delete all custom settings and return to default values.
|
|
1452
|
+
*
|
|
1453
|
+
* @returns Promise resolving to AppSettings - Default settings
|
|
1454
|
+
*
|
|
1455
|
+
* @example
|
|
1456
|
+
* ```typescript
|
|
1457
|
+
* const defaults = await client.admin.settings.app.reset()
|
|
1458
|
+
* console.log('Settings reset to defaults:', defaults)
|
|
1459
|
+
* ```
|
|
1460
|
+
*/
|
|
1461
|
+
reset(): Promise<AppSettings>;
|
|
1462
|
+
/**
|
|
1463
|
+
* Enable user signup
|
|
1464
|
+
*
|
|
1465
|
+
* Convenience method to enable user registration.
|
|
1466
|
+
*
|
|
1467
|
+
* @returns Promise resolving to AppSettings
|
|
1468
|
+
*
|
|
1469
|
+
* @example
|
|
1470
|
+
* ```typescript
|
|
1471
|
+
* await client.admin.settings.app.enableSignup()
|
|
1472
|
+
* ```
|
|
1473
|
+
*/
|
|
1474
|
+
enableSignup(): Promise<AppSettings>;
|
|
1475
|
+
/**
|
|
1476
|
+
* Disable user signup
|
|
1477
|
+
*
|
|
1478
|
+
* Convenience method to disable user registration.
|
|
1479
|
+
*
|
|
1480
|
+
* @returns Promise resolving to AppSettings
|
|
1481
|
+
*
|
|
1482
|
+
* @example
|
|
1483
|
+
* ```typescript
|
|
1484
|
+
* await client.admin.settings.app.disableSignup()
|
|
1485
|
+
* ```
|
|
1486
|
+
*/
|
|
1487
|
+
disableSignup(): Promise<AppSettings>;
|
|
1488
|
+
/**
|
|
1489
|
+
* Update password minimum length
|
|
1490
|
+
*
|
|
1491
|
+
* Convenience method to set password requirements.
|
|
1492
|
+
*
|
|
1493
|
+
* @param length - Minimum password length (8-128 characters)
|
|
1494
|
+
* @returns Promise resolving to AppSettings
|
|
1495
|
+
*
|
|
1496
|
+
* @example
|
|
1497
|
+
* ```typescript
|
|
1498
|
+
* await client.admin.settings.app.setPasswordMinLength(12)
|
|
1499
|
+
* ```
|
|
1500
|
+
*/
|
|
1501
|
+
setPasswordMinLength(length: number): Promise<AppSettings>;
|
|
1502
|
+
/**
|
|
1503
|
+
* Enable or disable a feature
|
|
1504
|
+
*
|
|
1505
|
+
* Convenience method to toggle feature flags.
|
|
1506
|
+
*
|
|
1507
|
+
* @param feature - Feature name ('realtime' | 'storage' | 'functions')
|
|
1508
|
+
* @param enabled - Whether to enable or disable the feature
|
|
1509
|
+
* @returns Promise resolving to AppSettings
|
|
1510
|
+
*
|
|
1511
|
+
* @example
|
|
1512
|
+
* ```typescript
|
|
1513
|
+
* // Enable realtime
|
|
1514
|
+
* await client.admin.settings.app.setFeature('realtime', true)
|
|
1515
|
+
*
|
|
1516
|
+
* // Disable storage
|
|
1517
|
+
* await client.admin.settings.app.setFeature('storage', false)
|
|
1518
|
+
* ```
|
|
1519
|
+
*/
|
|
1520
|
+
setFeature(feature: 'realtime' | 'storage' | 'functions', enabled: boolean): Promise<AppSettings>;
|
|
1521
|
+
/**
|
|
1522
|
+
* Enable or disable global rate limiting
|
|
1523
|
+
*
|
|
1524
|
+
* Convenience method to toggle global rate limiting.
|
|
1525
|
+
*
|
|
1526
|
+
* @param enabled - Whether to enable rate limiting
|
|
1527
|
+
* @returns Promise resolving to AppSettings
|
|
1528
|
+
*
|
|
1529
|
+
* @example
|
|
1530
|
+
* ```typescript
|
|
1531
|
+
* await client.admin.settings.app.setRateLimiting(true)
|
|
1532
|
+
* ```
|
|
1533
|
+
*/
|
|
1534
|
+
setRateLimiting(enabled: boolean): Promise<AppSettings>;
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Settings Manager
|
|
1538
|
+
*
|
|
1539
|
+
* Provides access to both system-level and application-level settings.
|
|
1540
|
+
*
|
|
1541
|
+
* @example
|
|
1542
|
+
* ```typescript
|
|
1543
|
+
* const settings = client.admin.settings
|
|
1544
|
+
*
|
|
1545
|
+
* // Access system settings
|
|
1546
|
+
* const systemSettings = await settings.system.list()
|
|
1547
|
+
*
|
|
1548
|
+
* // Access app settings
|
|
1549
|
+
* const appSettings = await settings.app.get()
|
|
1550
|
+
* ```
|
|
1551
|
+
*/
|
|
1552
|
+
declare class FluxbaseSettings {
|
|
1553
|
+
system: SystemSettingsManager;
|
|
1554
|
+
app: AppSettingsManager;
|
|
1555
|
+
constructor(fetch: FluxbaseFetch);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* DDL (Data Definition Language) Manager
|
|
1560
|
+
*
|
|
1561
|
+
* Provides methods for managing database schemas and tables programmatically.
|
|
1562
|
+
* This includes creating schemas, creating tables with custom columns, listing
|
|
1563
|
+
* schemas and tables, and deleting tables.
|
|
1564
|
+
*
|
|
1565
|
+
* @example
|
|
1566
|
+
* ```typescript
|
|
1567
|
+
* const ddl = client.admin.ddl
|
|
1568
|
+
*
|
|
1569
|
+
* // Create a new schema
|
|
1570
|
+
* await ddl.createSchema('analytics')
|
|
1571
|
+
*
|
|
1572
|
+
* // Create a table with columns
|
|
1573
|
+
* await ddl.createTable('analytics', 'events', [
|
|
1574
|
+
* { name: 'id', type: 'UUID', primaryKey: true, defaultValue: 'gen_random_uuid()' },
|
|
1575
|
+
* { name: 'user_id', type: 'UUID', nullable: false },
|
|
1576
|
+
* { name: 'event_name', type: 'TEXT', nullable: false },
|
|
1577
|
+
* { name: 'event_data', type: 'JSONB' },
|
|
1578
|
+
* { name: 'created_at', type: 'TIMESTAMPTZ', defaultValue: 'NOW()' }
|
|
1579
|
+
* ])
|
|
1580
|
+
*
|
|
1581
|
+
* // List all schemas
|
|
1582
|
+
* const { schemas } = await ddl.listSchemas()
|
|
1583
|
+
*
|
|
1584
|
+
* // List all tables in a schema
|
|
1585
|
+
* const { tables } = await ddl.listTables('analytics')
|
|
1586
|
+
*
|
|
1587
|
+
* // Delete a table
|
|
1588
|
+
* await ddl.deleteTable('analytics', 'events')
|
|
1589
|
+
* ```
|
|
1590
|
+
*/
|
|
1591
|
+
declare class DDLManager {
|
|
1592
|
+
private fetch;
|
|
1593
|
+
constructor(fetch: FluxbaseFetch);
|
|
1594
|
+
/**
|
|
1595
|
+
* Create a new database schema
|
|
1596
|
+
*
|
|
1597
|
+
* Creates a new schema in the database. Schemas are used to organize tables
|
|
1598
|
+
* into logical groups and provide namespace isolation.
|
|
1599
|
+
*
|
|
1600
|
+
* @param name - Schema name (must be valid PostgreSQL identifier)
|
|
1601
|
+
* @returns Promise resolving to CreateSchemaResponse
|
|
1602
|
+
*
|
|
1603
|
+
* @example
|
|
1604
|
+
* ```typescript
|
|
1605
|
+
* // Create a schema for analytics data
|
|
1606
|
+
* const result = await client.admin.ddl.createSchema('analytics')
|
|
1607
|
+
* console.log(result.message) // "Schema created successfully"
|
|
1608
|
+
* console.log(result.schema) // "analytics"
|
|
1609
|
+
* ```
|
|
1610
|
+
*/
|
|
1611
|
+
createSchema(name: string): Promise<CreateSchemaResponse>;
|
|
1612
|
+
/**
|
|
1613
|
+
* List all database schemas
|
|
1614
|
+
*
|
|
1615
|
+
* Retrieves a list of all schemas in the database. This includes both
|
|
1616
|
+
* system schemas (like 'public', 'pg_catalog') and user-created schemas.
|
|
1617
|
+
*
|
|
1618
|
+
* @returns Promise resolving to ListSchemasResponse
|
|
1619
|
+
*
|
|
1620
|
+
* @example
|
|
1621
|
+
* ```typescript
|
|
1622
|
+
* const { schemas } = await client.admin.ddl.listSchemas()
|
|
1623
|
+
*
|
|
1624
|
+
* schemas.forEach(schema => {
|
|
1625
|
+
* console.log(`Schema: ${schema.name}, Owner: ${schema.owner}`)
|
|
1626
|
+
* })
|
|
1627
|
+
* ```
|
|
1628
|
+
*/
|
|
1629
|
+
listSchemas(): Promise<ListSchemasResponse>;
|
|
1630
|
+
/**
|
|
1631
|
+
* Create a new table in a schema
|
|
1632
|
+
*
|
|
1633
|
+
* Creates a new table with the specified columns. Supports various column
|
|
1634
|
+
* options including primary keys, nullability, data types, and default values.
|
|
1635
|
+
*
|
|
1636
|
+
* @param schema - Schema name where the table will be created
|
|
1637
|
+
* @param name - Table name (must be valid PostgreSQL identifier)
|
|
1638
|
+
* @param columns - Array of column definitions
|
|
1639
|
+
* @returns Promise resolving to CreateTableResponse
|
|
1640
|
+
*
|
|
1641
|
+
* @example
|
|
1642
|
+
* ```typescript
|
|
1643
|
+
* // Create a users table
|
|
1644
|
+
* await client.admin.ddl.createTable('public', 'users', [
|
|
1645
|
+
* {
|
|
1646
|
+
* name: 'id',
|
|
1647
|
+
* type: 'UUID',
|
|
1648
|
+
* primaryKey: true,
|
|
1649
|
+
* defaultValue: 'gen_random_uuid()'
|
|
1650
|
+
* },
|
|
1651
|
+
* {
|
|
1652
|
+
* name: 'email',
|
|
1653
|
+
* type: 'TEXT',
|
|
1654
|
+
* nullable: false
|
|
1655
|
+
* },
|
|
1656
|
+
* {
|
|
1657
|
+
* name: 'name',
|
|
1658
|
+
* type: 'TEXT'
|
|
1659
|
+
* },
|
|
1660
|
+
* {
|
|
1661
|
+
* name: 'created_at',
|
|
1662
|
+
* type: 'TIMESTAMPTZ',
|
|
1663
|
+
* nullable: false,
|
|
1664
|
+
* defaultValue: 'NOW()'
|
|
1665
|
+
* }
|
|
1666
|
+
* ])
|
|
1667
|
+
* ```
|
|
1668
|
+
*
|
|
1669
|
+
* @example
|
|
1670
|
+
* ```typescript
|
|
1671
|
+
* // Create a products table with JSONB metadata
|
|
1672
|
+
* await client.admin.ddl.createTable('public', 'products', [
|
|
1673
|
+
* { name: 'id', type: 'SERIAL', primaryKey: true },
|
|
1674
|
+
* { name: 'name', type: 'TEXT', nullable: false },
|
|
1675
|
+
* { name: 'price', type: 'DECIMAL(10,2)', nullable: false },
|
|
1676
|
+
* { name: 'metadata', type: 'JSONB' },
|
|
1677
|
+
* { name: 'in_stock', type: 'BOOLEAN', defaultValue: 'true' }
|
|
1678
|
+
* ])
|
|
1679
|
+
* ```
|
|
1680
|
+
*/
|
|
1681
|
+
createTable(schema: string, name: string, columns: CreateColumnRequest[]): Promise<CreateTableResponse>;
|
|
1682
|
+
/**
|
|
1683
|
+
* List all tables in the database or a specific schema
|
|
1684
|
+
*
|
|
1685
|
+
* Retrieves a list of all tables. If a schema is specified, only tables
|
|
1686
|
+
* from that schema are returned. Otherwise, all tables from all schemas
|
|
1687
|
+
* are returned.
|
|
1688
|
+
*
|
|
1689
|
+
* @param schema - Optional schema name to filter tables
|
|
1690
|
+
* @returns Promise resolving to ListTablesResponse
|
|
1691
|
+
*
|
|
1692
|
+
* @example
|
|
1693
|
+
* ```typescript
|
|
1694
|
+
* // List all tables in the public schema
|
|
1695
|
+
* const { tables } = await client.admin.ddl.listTables('public')
|
|
1696
|
+
*
|
|
1697
|
+
* tables.forEach(table => {
|
|
1698
|
+
* console.log(`Table: ${table.schema}.${table.name}`)
|
|
1699
|
+
* table.columns?.forEach(col => {
|
|
1700
|
+
* console.log(` - ${col.name}: ${col.type}`)
|
|
1701
|
+
* })
|
|
1702
|
+
* })
|
|
1703
|
+
* ```
|
|
1704
|
+
*
|
|
1705
|
+
* @example
|
|
1706
|
+
* ```typescript
|
|
1707
|
+
* // List all tables across all schemas
|
|
1708
|
+
* const { tables } = await client.admin.ddl.listTables()
|
|
1709
|
+
*
|
|
1710
|
+
* const tablesBySchema = tables.reduce((acc, table) => {
|
|
1711
|
+
* if (!acc[table.schema]) acc[table.schema] = []
|
|
1712
|
+
* acc[table.schema].push(table.name)
|
|
1713
|
+
* return acc
|
|
1714
|
+
* }, {} as Record<string, string[]>)
|
|
1715
|
+
*
|
|
1716
|
+
* console.log(tablesBySchema)
|
|
1717
|
+
* ```
|
|
1718
|
+
*/
|
|
1719
|
+
listTables(schema?: string): Promise<ListTablesResponse>;
|
|
1720
|
+
/**
|
|
1721
|
+
* Delete a table from a schema
|
|
1722
|
+
*
|
|
1723
|
+
* Permanently deletes a table and all its data. This operation cannot be undone.
|
|
1724
|
+
*
|
|
1725
|
+
* @param schema - Schema name containing the table
|
|
1726
|
+
* @param name - Table name to delete
|
|
1727
|
+
* @returns Promise resolving to DeleteTableResponse
|
|
1728
|
+
*
|
|
1729
|
+
* @example
|
|
1730
|
+
* ```typescript
|
|
1731
|
+
* // Delete a table
|
|
1732
|
+
* const result = await client.admin.ddl.deleteTable('public', 'old_data')
|
|
1733
|
+
* console.log(result.message) // "Table deleted successfully"
|
|
1734
|
+
* ```
|
|
1735
|
+
*
|
|
1736
|
+
* @example
|
|
1737
|
+
* ```typescript
|
|
1738
|
+
* // Safe deletion with confirmation
|
|
1739
|
+
* const confirm = await askUser('Are you sure you want to delete this table?')
|
|
1740
|
+
* if (confirm) {
|
|
1741
|
+
* await client.admin.ddl.deleteTable('analytics', 'events')
|
|
1742
|
+
* console.log('Table deleted')
|
|
1743
|
+
* }
|
|
1744
|
+
* ```
|
|
1745
|
+
*/
|
|
1746
|
+
deleteTable(schema: string, name: string): Promise<DeleteTableResponse>;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* OAuth Provider Manager
|
|
1751
|
+
*
|
|
1752
|
+
* Manages OAuth provider configurations for third-party authentication.
|
|
1753
|
+
* Supports both built-in providers (Google, GitHub, etc.) and custom OAuth2 providers.
|
|
1754
|
+
*
|
|
1755
|
+
* @example
|
|
1756
|
+
* ```typescript
|
|
1757
|
+
* const oauth = client.admin.oauth
|
|
1758
|
+
*
|
|
1759
|
+
* // List all OAuth providers
|
|
1760
|
+
* const { providers } = await oauth.listProviders()
|
|
1761
|
+
*
|
|
1762
|
+
* // Create a new provider
|
|
1763
|
+
* await oauth.createProvider({
|
|
1764
|
+
* provider_name: 'github',
|
|
1765
|
+
* display_name: 'GitHub',
|
|
1766
|
+
* enabled: true,
|
|
1767
|
+
* client_id: 'your-client-id',
|
|
1768
|
+
* client_secret: 'your-client-secret',
|
|
1769
|
+
* redirect_url: 'https://yourapp.com/auth/callback',
|
|
1770
|
+
* scopes: ['user:email', 'read:user'],
|
|
1771
|
+
* is_custom: false
|
|
1772
|
+
* })
|
|
1773
|
+
*
|
|
1774
|
+
* // Update a provider
|
|
1775
|
+
* await oauth.updateProvider('provider-id', {
|
|
1776
|
+
* enabled: false
|
|
1777
|
+
* })
|
|
1778
|
+
*
|
|
1779
|
+
* // Delete a provider
|
|
1780
|
+
* await oauth.deleteProvider('provider-id')
|
|
1781
|
+
* ```
|
|
1782
|
+
*/
|
|
1783
|
+
declare class OAuthProviderManager {
|
|
1784
|
+
private fetch;
|
|
1785
|
+
constructor(fetch: FluxbaseFetch);
|
|
1786
|
+
/**
|
|
1787
|
+
* List all OAuth providers
|
|
1788
|
+
*
|
|
1789
|
+
* Retrieves all configured OAuth providers including both enabled and disabled providers.
|
|
1790
|
+
* Note: Client secrets are not included in the response for security reasons.
|
|
1791
|
+
*
|
|
1792
|
+
* @returns Promise resolving to ListOAuthProvidersResponse
|
|
1793
|
+
*
|
|
1794
|
+
* @example
|
|
1795
|
+
* ```typescript
|
|
1796
|
+
* const { providers } = await client.admin.oauth.listProviders()
|
|
1797
|
+
*
|
|
1798
|
+
* providers.forEach(provider => {
|
|
1799
|
+
* console.log(`${provider.display_name}: ${provider.enabled ? 'enabled' : 'disabled'}`)
|
|
1800
|
+
* })
|
|
1801
|
+
* ```
|
|
1802
|
+
*/
|
|
1803
|
+
listProviders(): Promise<OAuthProvider[]>;
|
|
1804
|
+
/**
|
|
1805
|
+
* Get a specific OAuth provider by ID
|
|
1806
|
+
*
|
|
1807
|
+
* Retrieves detailed configuration for a single OAuth provider.
|
|
1808
|
+
* Note: Client secret is not included in the response.
|
|
1809
|
+
*
|
|
1810
|
+
* @param providerId - Provider ID (UUID)
|
|
1811
|
+
* @returns Promise resolving to OAuthProvider
|
|
1812
|
+
*
|
|
1813
|
+
* @example
|
|
1814
|
+
* ```typescript
|
|
1815
|
+
* const provider = await client.admin.oauth.getProvider('provider-uuid')
|
|
1816
|
+
*
|
|
1817
|
+
* console.log('Provider:', provider.display_name)
|
|
1818
|
+
* console.log('Scopes:', provider.scopes.join(', '))
|
|
1819
|
+
* console.log('Redirect URL:', provider.redirect_url)
|
|
1820
|
+
* ```
|
|
1821
|
+
*/
|
|
1822
|
+
getProvider(providerId: string): Promise<OAuthProvider>;
|
|
1823
|
+
/**
|
|
1824
|
+
* Create a new OAuth provider
|
|
1825
|
+
*
|
|
1826
|
+
* Creates a new OAuth provider configuration. For built-in providers (Google, GitHub, etc.),
|
|
1827
|
+
* set `is_custom` to false. For custom OAuth2 providers, set `is_custom` to true and provide
|
|
1828
|
+
* the authorization, token, and user info URLs.
|
|
1829
|
+
*
|
|
1830
|
+
* @param request - OAuth provider configuration
|
|
1831
|
+
* @returns Promise resolving to CreateOAuthProviderResponse
|
|
1832
|
+
*
|
|
1833
|
+
* @example
|
|
1834
|
+
* ```typescript
|
|
1835
|
+
* // Create GitHub provider
|
|
1836
|
+
* const result = await client.admin.oauth.createProvider({
|
|
1837
|
+
* provider_name: 'github',
|
|
1838
|
+
* display_name: 'GitHub',
|
|
1839
|
+
* enabled: true,
|
|
1840
|
+
* client_id: process.env.GITHUB_CLIENT_ID,
|
|
1841
|
+
* client_secret: process.env.GITHUB_CLIENT_SECRET,
|
|
1842
|
+
* redirect_url: 'https://yourapp.com/auth/callback',
|
|
1843
|
+
* scopes: ['user:email', 'read:user'],
|
|
1844
|
+
* is_custom: false
|
|
1845
|
+
* })
|
|
1846
|
+
*
|
|
1847
|
+
* console.log('Provider created:', result.id)
|
|
1848
|
+
* ```
|
|
1849
|
+
*
|
|
1850
|
+
* @example
|
|
1851
|
+
* ```typescript
|
|
1852
|
+
* // Create custom OAuth2 provider
|
|
1853
|
+
* await client.admin.oauth.createProvider({
|
|
1854
|
+
* provider_name: 'custom_sso',
|
|
1855
|
+
* display_name: 'Custom SSO',
|
|
1856
|
+
* enabled: true,
|
|
1857
|
+
* client_id: 'client-id',
|
|
1858
|
+
* client_secret: 'client-secret',
|
|
1859
|
+
* redirect_url: 'https://yourapp.com/auth/callback',
|
|
1860
|
+
* scopes: ['openid', 'profile', 'email'],
|
|
1861
|
+
* is_custom: true,
|
|
1862
|
+
* authorization_url: 'https://sso.example.com/oauth/authorize',
|
|
1863
|
+
* token_url: 'https://sso.example.com/oauth/token',
|
|
1864
|
+
* user_info_url: 'https://sso.example.com/oauth/userinfo'
|
|
1865
|
+
* })
|
|
1866
|
+
* ```
|
|
1867
|
+
*/
|
|
1868
|
+
createProvider(request: CreateOAuthProviderRequest): Promise<CreateOAuthProviderResponse>;
|
|
1869
|
+
/**
|
|
1870
|
+
* Update an existing OAuth provider
|
|
1871
|
+
*
|
|
1872
|
+
* Updates an OAuth provider configuration. All fields are optional - only provided fields
|
|
1873
|
+
* will be updated. To update the client secret, provide a non-empty value.
|
|
1874
|
+
*
|
|
1875
|
+
* @param providerId - Provider ID (UUID)
|
|
1876
|
+
* @param request - Fields to update
|
|
1877
|
+
* @returns Promise resolving to UpdateOAuthProviderResponse
|
|
1878
|
+
*
|
|
1879
|
+
* @example
|
|
1880
|
+
* ```typescript
|
|
1881
|
+
* // Disable a provider
|
|
1882
|
+
* await client.admin.oauth.updateProvider('provider-id', {
|
|
1883
|
+
* enabled: false
|
|
1884
|
+
* })
|
|
1885
|
+
* ```
|
|
1886
|
+
*
|
|
1887
|
+
* @example
|
|
1888
|
+
* ```typescript
|
|
1889
|
+
* // Update scopes and redirect URL
|
|
1890
|
+
* await client.admin.oauth.updateProvider('provider-id', {
|
|
1891
|
+
* scopes: ['user:email', 'read:user', 'read:org'],
|
|
1892
|
+
* redirect_url: 'https://newdomain.com/auth/callback'
|
|
1893
|
+
* })
|
|
1894
|
+
* ```
|
|
1895
|
+
*
|
|
1896
|
+
* @example
|
|
1897
|
+
* ```typescript
|
|
1898
|
+
* // Rotate client secret
|
|
1899
|
+
* await client.admin.oauth.updateProvider('provider-id', {
|
|
1900
|
+
* client_id: 'new-client-id',
|
|
1901
|
+
* client_secret: 'new-client-secret'
|
|
1902
|
+
* })
|
|
1903
|
+
* ```
|
|
1904
|
+
*/
|
|
1905
|
+
updateProvider(providerId: string, request: UpdateOAuthProviderRequest): Promise<UpdateOAuthProviderResponse>;
|
|
1906
|
+
/**
|
|
1907
|
+
* Delete an OAuth provider
|
|
1908
|
+
*
|
|
1909
|
+
* Permanently deletes an OAuth provider configuration. This will prevent users from
|
|
1910
|
+
* authenticating with this provider.
|
|
1911
|
+
*
|
|
1912
|
+
* @param providerId - Provider ID (UUID) to delete
|
|
1913
|
+
* @returns Promise resolving to DeleteOAuthProviderResponse
|
|
1914
|
+
*
|
|
1915
|
+
* @example
|
|
1916
|
+
* ```typescript
|
|
1917
|
+
* await client.admin.oauth.deleteProvider('provider-id')
|
|
1918
|
+
* console.log('Provider deleted')
|
|
1919
|
+
* ```
|
|
1920
|
+
*
|
|
1921
|
+
* @example
|
|
1922
|
+
* ```typescript
|
|
1923
|
+
* // Safe deletion with confirmation
|
|
1924
|
+
* const provider = await client.admin.oauth.getProvider('provider-id')
|
|
1925
|
+
* const confirmed = await confirm(`Delete ${provider.display_name}?`)
|
|
1926
|
+
*
|
|
1927
|
+
* if (confirmed) {
|
|
1928
|
+
* await client.admin.oauth.deleteProvider('provider-id')
|
|
1929
|
+
* }
|
|
1930
|
+
* ```
|
|
1931
|
+
*/
|
|
1932
|
+
deleteProvider(providerId: string): Promise<DeleteOAuthProviderResponse>;
|
|
1933
|
+
/**
|
|
1934
|
+
* Enable an OAuth provider
|
|
1935
|
+
*
|
|
1936
|
+
* Convenience method to enable a provider.
|
|
1937
|
+
*
|
|
1938
|
+
* @param providerId - Provider ID (UUID)
|
|
1939
|
+
* @returns Promise resolving to UpdateOAuthProviderResponse
|
|
1940
|
+
*
|
|
1941
|
+
* @example
|
|
1942
|
+
* ```typescript
|
|
1943
|
+
* await client.admin.oauth.enableProvider('provider-id')
|
|
1944
|
+
* ```
|
|
1945
|
+
*/
|
|
1946
|
+
enableProvider(providerId: string): Promise<UpdateOAuthProviderResponse>;
|
|
1947
|
+
/**
|
|
1948
|
+
* Disable an OAuth provider
|
|
1949
|
+
*
|
|
1950
|
+
* Convenience method to disable a provider.
|
|
1951
|
+
*
|
|
1952
|
+
* @param providerId - Provider ID (UUID)
|
|
1953
|
+
* @returns Promise resolving to UpdateOAuthProviderResponse
|
|
1954
|
+
*
|
|
1955
|
+
* @example
|
|
1956
|
+
* ```typescript
|
|
1957
|
+
* await client.admin.oauth.disableProvider('provider-id')
|
|
1958
|
+
* ```
|
|
1959
|
+
*/
|
|
1960
|
+
disableProvider(providerId: string): Promise<UpdateOAuthProviderResponse>;
|
|
1961
|
+
}
|
|
1962
|
+
/**
|
|
1963
|
+
* Authentication Settings Manager
|
|
1964
|
+
*
|
|
1965
|
+
* Manages global authentication settings including password requirements, session timeouts,
|
|
1966
|
+
* and signup configuration.
|
|
1967
|
+
*
|
|
1968
|
+
* @example
|
|
1969
|
+
* ```typescript
|
|
1970
|
+
* const authSettings = client.admin.authSettings
|
|
1971
|
+
*
|
|
1972
|
+
* // Get current settings
|
|
1973
|
+
* const settings = await authSettings.get()
|
|
1974
|
+
*
|
|
1975
|
+
* // Update settings
|
|
1976
|
+
* await authSettings.update({
|
|
1977
|
+
* password_min_length: 12,
|
|
1978
|
+
* password_require_uppercase: true,
|
|
1979
|
+
* session_timeout_minutes: 120
|
|
1980
|
+
* })
|
|
1981
|
+
* ```
|
|
1982
|
+
*/
|
|
1983
|
+
declare class AuthSettingsManager {
|
|
1984
|
+
private fetch;
|
|
1985
|
+
constructor(fetch: FluxbaseFetch);
|
|
1986
|
+
/**
|
|
1987
|
+
* Get current authentication settings
|
|
1988
|
+
*
|
|
1989
|
+
* Retrieves all authentication configuration settings.
|
|
1990
|
+
*
|
|
1991
|
+
* @returns Promise resolving to AuthSettings
|
|
1992
|
+
*
|
|
1993
|
+
* @example
|
|
1994
|
+
* ```typescript
|
|
1995
|
+
* const settings = await client.admin.authSettings.get()
|
|
1996
|
+
*
|
|
1997
|
+
* console.log('Password min length:', settings.password_min_length)
|
|
1998
|
+
* console.log('Signup enabled:', settings.enable_signup)
|
|
1999
|
+
* console.log('Session timeout:', settings.session_timeout_minutes, 'minutes')
|
|
2000
|
+
* ```
|
|
2001
|
+
*/
|
|
2002
|
+
get(): Promise<AuthSettings>;
|
|
2003
|
+
/**
|
|
2004
|
+
* Update authentication settings
|
|
2005
|
+
*
|
|
2006
|
+
* Updates one or more authentication settings. All fields are optional - only provided
|
|
2007
|
+
* fields will be updated.
|
|
2008
|
+
*
|
|
2009
|
+
* @param request - Settings to update
|
|
2010
|
+
* @returns Promise resolving to UpdateAuthSettingsResponse
|
|
2011
|
+
*
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```typescript
|
|
2014
|
+
* // Strengthen password requirements
|
|
2015
|
+
* await client.admin.authSettings.update({
|
|
2016
|
+
* password_min_length: 16,
|
|
2017
|
+
* password_require_uppercase: true,
|
|
2018
|
+
* password_require_lowercase: true,
|
|
2019
|
+
* password_require_number: true,
|
|
2020
|
+
* password_require_special: true
|
|
2021
|
+
* })
|
|
2022
|
+
* ```
|
|
2023
|
+
*
|
|
2024
|
+
* @example
|
|
2025
|
+
* ```typescript
|
|
2026
|
+
* // Extend session timeout
|
|
2027
|
+
* await client.admin.authSettings.update({
|
|
2028
|
+
* session_timeout_minutes: 240,
|
|
2029
|
+
* max_sessions_per_user: 10
|
|
2030
|
+
* })
|
|
2031
|
+
* ```
|
|
2032
|
+
*
|
|
2033
|
+
* @example
|
|
2034
|
+
* ```typescript
|
|
2035
|
+
* // Disable email verification during development
|
|
2036
|
+
* await client.admin.authSettings.update({
|
|
2037
|
+
* require_email_verification: false
|
|
2038
|
+
* })
|
|
2039
|
+
* ```
|
|
2040
|
+
*/
|
|
2041
|
+
update(request: UpdateAuthSettingsRequest): Promise<UpdateAuthSettingsResponse>;
|
|
2042
|
+
}
|
|
2043
|
+
/**
|
|
2044
|
+
* OAuth Configuration Manager
|
|
2045
|
+
*
|
|
2046
|
+
* Root manager providing access to OAuth provider and authentication settings management.
|
|
2047
|
+
*
|
|
2048
|
+
* @example
|
|
2049
|
+
* ```typescript
|
|
2050
|
+
* const oauth = client.admin.oauth
|
|
2051
|
+
*
|
|
2052
|
+
* // Manage OAuth providers
|
|
2053
|
+
* const providers = await oauth.providers.listProviders()
|
|
2054
|
+
*
|
|
2055
|
+
* // Manage auth settings
|
|
2056
|
+
* const settings = await oauth.authSettings.get()
|
|
2057
|
+
* ```
|
|
2058
|
+
*/
|
|
2059
|
+
declare class FluxbaseOAuth {
|
|
2060
|
+
providers: OAuthProviderManager;
|
|
2061
|
+
authSettings: AuthSettingsManager;
|
|
2062
|
+
constructor(fetch: FluxbaseFetch);
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
/**
|
|
2066
|
+
* Impersonation Manager
|
|
2067
|
+
*
|
|
2068
|
+
* Manages user impersonation for debugging, testing RLS policies, and customer support.
|
|
2069
|
+
* Allows admins to view data as different users, anonymous visitors, or with service role permissions.
|
|
2070
|
+
*
|
|
2071
|
+
* All impersonation sessions are logged in the audit trail for security and compliance.
|
|
2072
|
+
*
|
|
2073
|
+
* @example
|
|
2074
|
+
* ```typescript
|
|
2075
|
+
* const impersonation = client.admin.impersonation
|
|
2076
|
+
*
|
|
2077
|
+
* // Impersonate a specific user
|
|
2078
|
+
* const { session, access_token } = await impersonation.impersonateUser({
|
|
2079
|
+
* target_user_id: 'user-uuid',
|
|
2080
|
+
* reason: 'Support ticket #1234'
|
|
2081
|
+
* })
|
|
2082
|
+
*
|
|
2083
|
+
* // Impersonate anonymous user
|
|
2084
|
+
* await impersonation.impersonateAnon({
|
|
2085
|
+
* reason: 'Testing public data access'
|
|
2086
|
+
* })
|
|
2087
|
+
*
|
|
2088
|
+
* // Impersonate with service role
|
|
2089
|
+
* await impersonation.impersonateService({
|
|
2090
|
+
* reason: 'Administrative query'
|
|
2091
|
+
* })
|
|
2092
|
+
*
|
|
2093
|
+
* // Stop impersonation
|
|
2094
|
+
* await impersonation.stop()
|
|
2095
|
+
* ```
|
|
2096
|
+
*/
|
|
2097
|
+
declare class ImpersonationManager {
|
|
2098
|
+
private fetch;
|
|
2099
|
+
constructor(fetch: FluxbaseFetch);
|
|
2100
|
+
/**
|
|
2101
|
+
* Impersonate a specific user
|
|
2102
|
+
*
|
|
2103
|
+
* Start an impersonation session as a specific user. This allows you to see data
|
|
2104
|
+
* exactly as that user would see it, respecting all RLS policies and permissions.
|
|
2105
|
+
*
|
|
2106
|
+
* @param request - Impersonation request with target user ID and reason
|
|
2107
|
+
* @returns Promise resolving to impersonation session with access token
|
|
2108
|
+
*
|
|
2109
|
+
* @example
|
|
2110
|
+
* ```typescript
|
|
2111
|
+
* const result = await client.admin.impersonation.impersonateUser({
|
|
2112
|
+
* target_user_id: 'user-123',
|
|
2113
|
+
* reason: 'Support ticket #5678 - user reports missing data'
|
|
2114
|
+
* })
|
|
2115
|
+
*
|
|
2116
|
+
* console.log('Impersonating:', result.target_user.email)
|
|
2117
|
+
* console.log('Session ID:', result.session.id)
|
|
2118
|
+
*
|
|
2119
|
+
* // Use the access token for subsequent requests
|
|
2120
|
+
* // (typically handled automatically by the SDK)
|
|
2121
|
+
* ```
|
|
2122
|
+
*/
|
|
2123
|
+
impersonateUser(request: ImpersonateUserRequest): Promise<StartImpersonationResponse>;
|
|
2124
|
+
/**
|
|
2125
|
+
* Impersonate anonymous user
|
|
2126
|
+
*
|
|
2127
|
+
* Start an impersonation session as an unauthenticated user. This allows you to see
|
|
2128
|
+
* what data is publicly accessible and test RLS policies for anonymous access.
|
|
2129
|
+
*
|
|
2130
|
+
* @param request - Impersonation request with reason
|
|
2131
|
+
* @returns Promise resolving to impersonation session with access token
|
|
2132
|
+
*
|
|
2133
|
+
* @example
|
|
2134
|
+
* ```typescript
|
|
2135
|
+
* await client.admin.impersonation.impersonateAnon({
|
|
2136
|
+
* reason: 'Testing public data access for blog posts'
|
|
2137
|
+
* })
|
|
2138
|
+
*
|
|
2139
|
+
* // Now all queries will use anonymous permissions
|
|
2140
|
+
* const publicPosts = await client.from('posts').select('*')
|
|
2141
|
+
* console.log('Public posts:', publicPosts.length)
|
|
2142
|
+
* ```
|
|
2143
|
+
*/
|
|
2144
|
+
impersonateAnon(request: ImpersonateAnonRequest): Promise<StartImpersonationResponse>;
|
|
2145
|
+
/**
|
|
2146
|
+
* Impersonate with service role
|
|
2147
|
+
*
|
|
2148
|
+
* Start an impersonation session with service-level permissions. This provides elevated
|
|
2149
|
+
* access that may bypass RLS policies, useful for administrative operations.
|
|
2150
|
+
*
|
|
2151
|
+
* @param request - Impersonation request with reason
|
|
2152
|
+
* @returns Promise resolving to impersonation session with access token
|
|
2153
|
+
*
|
|
2154
|
+
* @example
|
|
2155
|
+
* ```typescript
|
|
2156
|
+
* await client.admin.impersonation.impersonateService({
|
|
2157
|
+
* reason: 'Administrative data cleanup'
|
|
2158
|
+
* })
|
|
2159
|
+
*
|
|
2160
|
+
* // Now all queries will use service role permissions
|
|
2161
|
+
* const allRecords = await client.from('sensitive_data').select('*')
|
|
2162
|
+
* console.log('All records:', allRecords.length)
|
|
2163
|
+
* ```
|
|
2164
|
+
*/
|
|
2165
|
+
impersonateService(request: ImpersonateServiceRequest): Promise<StartImpersonationResponse>;
|
|
2166
|
+
/**
|
|
2167
|
+
* Stop impersonation
|
|
2168
|
+
*
|
|
2169
|
+
* Ends the current impersonation session and returns to admin context.
|
|
2170
|
+
* The session is marked as ended in the audit trail.
|
|
2171
|
+
*
|
|
2172
|
+
* @returns Promise resolving to stop confirmation
|
|
2173
|
+
*
|
|
2174
|
+
* @example
|
|
2175
|
+
* ```typescript
|
|
2176
|
+
* await client.admin.impersonation.stop()
|
|
2177
|
+
* console.log('Impersonation ended')
|
|
2178
|
+
*
|
|
2179
|
+
* // Subsequent queries will use admin permissions
|
|
2180
|
+
* ```
|
|
2181
|
+
*/
|
|
2182
|
+
stop(): Promise<StopImpersonationResponse>;
|
|
2183
|
+
/**
|
|
2184
|
+
* Get current impersonation session
|
|
2185
|
+
*
|
|
2186
|
+
* Retrieves information about the active impersonation session, if any.
|
|
2187
|
+
*
|
|
2188
|
+
* @returns Promise resolving to current impersonation session or null
|
|
2189
|
+
*
|
|
2190
|
+
* @example
|
|
2191
|
+
* ```typescript
|
|
2192
|
+
* const current = await client.admin.impersonation.getCurrent()
|
|
2193
|
+
*
|
|
2194
|
+
* if (current.session) {
|
|
2195
|
+
* console.log('Currently impersonating:', current.target_user?.email)
|
|
2196
|
+
* console.log('Reason:', current.session.reason)
|
|
2197
|
+
* console.log('Started:', current.session.started_at)
|
|
2198
|
+
* } else {
|
|
2199
|
+
* console.log('No active impersonation')
|
|
2200
|
+
* }
|
|
2201
|
+
* ```
|
|
2202
|
+
*/
|
|
2203
|
+
getCurrent(): Promise<GetImpersonationResponse>;
|
|
2204
|
+
/**
|
|
2205
|
+
* List impersonation sessions (audit trail)
|
|
2206
|
+
*
|
|
2207
|
+
* Retrieves a list of impersonation sessions for audit and compliance purposes.
|
|
2208
|
+
* Can be filtered by admin user, target user, type, and active status.
|
|
2209
|
+
*
|
|
2210
|
+
* @param options - Filter and pagination options
|
|
2211
|
+
* @returns Promise resolving to list of impersonation sessions
|
|
2212
|
+
*
|
|
2213
|
+
* @example
|
|
2214
|
+
* ```typescript
|
|
2215
|
+
* // List all sessions
|
|
2216
|
+
* const { sessions, total } = await client.admin.impersonation.listSessions()
|
|
2217
|
+
* console.log(`Total sessions: ${total}`)
|
|
2218
|
+
*
|
|
2219
|
+
* // List active sessions only
|
|
2220
|
+
* const active = await client.admin.impersonation.listSessions({
|
|
2221
|
+
* is_active: true
|
|
2222
|
+
* })
|
|
2223
|
+
* console.log('Active sessions:', active.sessions.length)
|
|
2224
|
+
*
|
|
2225
|
+
* // List sessions for a specific admin
|
|
2226
|
+
* const adminSessions = await client.admin.impersonation.listSessions({
|
|
2227
|
+
* admin_user_id: 'admin-uuid',
|
|
2228
|
+
* limit: 50
|
|
2229
|
+
* })
|
|
2230
|
+
*
|
|
2231
|
+
* // List user impersonation sessions only
|
|
2232
|
+
* const userSessions = await client.admin.impersonation.listSessions({
|
|
2233
|
+
* impersonation_type: 'user',
|
|
2234
|
+
* offset: 0,
|
|
2235
|
+
* limit: 100
|
|
2236
|
+
* })
|
|
2237
|
+
* ```
|
|
2238
|
+
*
|
|
2239
|
+
* @example
|
|
2240
|
+
* ```typescript
|
|
2241
|
+
* // Audit trail: Find who impersonated a specific user
|
|
2242
|
+
* const userHistory = await client.admin.impersonation.listSessions({
|
|
2243
|
+
* target_user_id: 'user-uuid'
|
|
2244
|
+
* })
|
|
2245
|
+
*
|
|
2246
|
+
* userHistory.sessions.forEach(session => {
|
|
2247
|
+
* console.log(`Admin ${session.admin_user_id} impersonated user`)
|
|
2248
|
+
* console.log(`Reason: ${session.reason}`)
|
|
2249
|
+
* console.log(`Duration: ${session.started_at} - ${session.ended_at}`)
|
|
2250
|
+
* })
|
|
2251
|
+
* ```
|
|
2252
|
+
*/
|
|
2253
|
+
listSessions(options?: ListImpersonationSessionsOptions): Promise<ListImpersonationSessionsResponse>;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
/**
|
|
2257
|
+
* API Keys management client
|
|
2258
|
+
*
|
|
2259
|
+
* Provides methods for managing API keys for service-to-service authentication.
|
|
2260
|
+
* API keys allow external services to authenticate without user credentials.
|
|
2261
|
+
*
|
|
2262
|
+
* @example
|
|
2263
|
+
* ```typescript
|
|
2264
|
+
* const client = createClient({ url: 'http://localhost:8080' })
|
|
2265
|
+
* await client.auth.login({ email: 'user@example.com', password: 'password' })
|
|
2266
|
+
*
|
|
2267
|
+
* // Create an API key
|
|
2268
|
+
* const { api_key, key } = await client.management.apiKeys.create({
|
|
2269
|
+
* name: 'Production Service',
|
|
2270
|
+
* scopes: ['read:users', 'write:users'],
|
|
2271
|
+
* rate_limit_per_minute: 100
|
|
2272
|
+
* })
|
|
2273
|
+
*
|
|
2274
|
+
* // List API keys
|
|
2275
|
+
* const { api_keys } = await client.management.apiKeys.list()
|
|
2276
|
+
* ```
|
|
2277
|
+
*
|
|
2278
|
+
* @category Management
|
|
2279
|
+
*/
|
|
2280
|
+
declare class APIKeysManager {
|
|
2281
|
+
private fetch;
|
|
2282
|
+
constructor(fetch: FluxbaseFetch);
|
|
2283
|
+
/**
|
|
2284
|
+
* Create a new API key
|
|
2285
|
+
*
|
|
2286
|
+
* @param request - API key configuration
|
|
2287
|
+
* @returns Created API key with the full key value (only shown once)
|
|
2288
|
+
*
|
|
2289
|
+
* @example
|
|
2290
|
+
* ```typescript
|
|
2291
|
+
* const { api_key, key } = await client.management.apiKeys.create({
|
|
2292
|
+
* name: 'Production Service',
|
|
2293
|
+
* description: 'API key for production service',
|
|
2294
|
+
* scopes: ['read:users', 'write:users'],
|
|
2295
|
+
* rate_limit_per_minute: 100,
|
|
2296
|
+
* expires_at: '2025-12-31T23:59:59Z'
|
|
2297
|
+
* })
|
|
2298
|
+
*
|
|
2299
|
+
* // Store the key securely - it won't be shown again
|
|
2300
|
+
* console.log('API Key:', key)
|
|
2301
|
+
* ```
|
|
2302
|
+
*/
|
|
2303
|
+
create(request: CreateAPIKeyRequest): Promise<CreateAPIKeyResponse>;
|
|
2304
|
+
/**
|
|
2305
|
+
* List all API keys for the authenticated user
|
|
2306
|
+
*
|
|
2307
|
+
* @returns List of API keys (without full key values)
|
|
2308
|
+
*
|
|
2309
|
+
* @example
|
|
2310
|
+
* ```typescript
|
|
2311
|
+
* const { api_keys, total } = await client.management.apiKeys.list()
|
|
2312
|
+
*
|
|
2313
|
+
* api_keys.forEach(key => {
|
|
2314
|
+
* console.log(`${key.name}: ${key.key_prefix}... (expires: ${key.expires_at})`)
|
|
2315
|
+
* })
|
|
2316
|
+
* ```
|
|
2317
|
+
*/
|
|
2318
|
+
list(): Promise<ListAPIKeysResponse>;
|
|
2319
|
+
/**
|
|
2320
|
+
* Get a specific API key by ID
|
|
2321
|
+
*
|
|
2322
|
+
* @param keyId - API key ID
|
|
2323
|
+
* @returns API key details
|
|
2324
|
+
*
|
|
2325
|
+
* @example
|
|
2326
|
+
* ```typescript
|
|
2327
|
+
* const apiKey = await client.management.apiKeys.get('key-uuid')
|
|
2328
|
+
* console.log('Last used:', apiKey.last_used_at)
|
|
2329
|
+
* ```
|
|
2330
|
+
*/
|
|
2331
|
+
get(keyId: string): Promise<APIKey>;
|
|
2332
|
+
/**
|
|
2333
|
+
* Update an API key
|
|
2334
|
+
*
|
|
2335
|
+
* @param keyId - API key ID
|
|
2336
|
+
* @param updates - Fields to update
|
|
2337
|
+
* @returns Updated API key
|
|
2338
|
+
*
|
|
2339
|
+
* @example
|
|
2340
|
+
* ```typescript
|
|
2341
|
+
* const updated = await client.management.apiKeys.update('key-uuid', {
|
|
2342
|
+
* name: 'Updated Name',
|
|
2343
|
+
* rate_limit_per_minute: 200
|
|
2344
|
+
* })
|
|
2345
|
+
* ```
|
|
2346
|
+
*/
|
|
2347
|
+
update(keyId: string, updates: UpdateAPIKeyRequest): Promise<APIKey>;
|
|
2348
|
+
/**
|
|
2349
|
+
* Revoke an API key
|
|
2350
|
+
*
|
|
2351
|
+
* Revoked keys can no longer be used but remain in the system for audit purposes.
|
|
2352
|
+
*
|
|
2353
|
+
* @param keyId - API key ID
|
|
2354
|
+
* @returns Revocation confirmation
|
|
2355
|
+
*
|
|
2356
|
+
* @example
|
|
2357
|
+
* ```typescript
|
|
2358
|
+
* await client.management.apiKeys.revoke('key-uuid')
|
|
2359
|
+
* console.log('API key revoked')
|
|
2360
|
+
* ```
|
|
2361
|
+
*/
|
|
2362
|
+
revoke(keyId: string): Promise<RevokeAPIKeyResponse>;
|
|
2363
|
+
/**
|
|
2364
|
+
* Delete an API key
|
|
2365
|
+
*
|
|
2366
|
+
* Permanently removes the API key from the system.
|
|
2367
|
+
*
|
|
2368
|
+
* @param keyId - API key ID
|
|
2369
|
+
* @returns Deletion confirmation
|
|
2370
|
+
*
|
|
2371
|
+
* @example
|
|
2372
|
+
* ```typescript
|
|
2373
|
+
* await client.management.apiKeys.delete('key-uuid')
|
|
2374
|
+
* console.log('API key deleted')
|
|
2375
|
+
* ```
|
|
2376
|
+
*/
|
|
2377
|
+
delete(keyId: string): Promise<DeleteAPIKeyResponse>;
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* Webhooks management client
|
|
2381
|
+
*
|
|
2382
|
+
* Provides methods for managing webhooks to receive real-time event notifications.
|
|
2383
|
+
* Webhooks allow your application to be notified when events occur in Fluxbase.
|
|
2384
|
+
*
|
|
2385
|
+
* @example
|
|
2386
|
+
* ```typescript
|
|
2387
|
+
* const client = createClient({ url: 'http://localhost:8080' })
|
|
2388
|
+
* await client.auth.login({ email: 'user@example.com', password: 'password' })
|
|
2389
|
+
*
|
|
2390
|
+
* // Create a webhook
|
|
2391
|
+
* const webhook = await client.management.webhooks.create({
|
|
2392
|
+
* url: 'https://myapp.com/webhook',
|
|
2393
|
+
* events: ['user.created', 'user.updated'],
|
|
2394
|
+
* secret: 'my-webhook-secret'
|
|
2395
|
+
* })
|
|
2396
|
+
*
|
|
2397
|
+
* // Test the webhook
|
|
2398
|
+
* const result = await client.management.webhooks.test(webhook.id)
|
|
2399
|
+
* ```
|
|
2400
|
+
*
|
|
2401
|
+
* @category Management
|
|
2402
|
+
*/
|
|
2403
|
+
declare class WebhooksManager {
|
|
2404
|
+
private fetch;
|
|
2405
|
+
constructor(fetch: FluxbaseFetch);
|
|
2406
|
+
/**
|
|
2407
|
+
* Create a new webhook
|
|
2408
|
+
*
|
|
2409
|
+
* @param request - Webhook configuration
|
|
2410
|
+
* @returns Created webhook
|
|
2411
|
+
*
|
|
2412
|
+
* @example
|
|
2413
|
+
* ```typescript
|
|
2414
|
+
* const webhook = await client.management.webhooks.create({
|
|
2415
|
+
* url: 'https://myapp.com/webhook',
|
|
2416
|
+
* events: ['user.created', 'user.updated', 'user.deleted'],
|
|
2417
|
+
* description: 'User events webhook',
|
|
2418
|
+
* secret: 'my-webhook-secret'
|
|
2419
|
+
* })
|
|
2420
|
+
* ```
|
|
2421
|
+
*/
|
|
2422
|
+
create(request: CreateWebhookRequest): Promise<Webhook>;
|
|
2423
|
+
/**
|
|
2424
|
+
* List all webhooks for the authenticated user
|
|
2425
|
+
*
|
|
2426
|
+
* @returns List of webhooks
|
|
2427
|
+
*
|
|
2428
|
+
* @example
|
|
2429
|
+
* ```typescript
|
|
2430
|
+
* const { webhooks, total } = await client.management.webhooks.list()
|
|
2431
|
+
*
|
|
2432
|
+
* webhooks.forEach(webhook => {
|
|
2433
|
+
* console.log(`${webhook.url}: ${webhook.is_active ? 'active' : 'inactive'}`)
|
|
2434
|
+
* })
|
|
2435
|
+
* ```
|
|
2436
|
+
*/
|
|
2437
|
+
list(): Promise<ListWebhooksResponse>;
|
|
2438
|
+
/**
|
|
2439
|
+
* Get a specific webhook by ID
|
|
2440
|
+
*
|
|
2441
|
+
* @param webhookId - Webhook ID
|
|
2442
|
+
* @returns Webhook details
|
|
2443
|
+
*
|
|
2444
|
+
* @example
|
|
2445
|
+
* ```typescript
|
|
2446
|
+
* const webhook = await client.management.webhooks.get('webhook-uuid')
|
|
2447
|
+
* console.log('Events:', webhook.events)
|
|
2448
|
+
* ```
|
|
2449
|
+
*/
|
|
2450
|
+
get(webhookId: string): Promise<Webhook>;
|
|
2451
|
+
/**
|
|
2452
|
+
* Update a webhook
|
|
2453
|
+
*
|
|
2454
|
+
* @param webhookId - Webhook ID
|
|
2455
|
+
* @param updates - Fields to update
|
|
2456
|
+
* @returns Updated webhook
|
|
2457
|
+
*
|
|
2458
|
+
* @example
|
|
2459
|
+
* ```typescript
|
|
2460
|
+
* const updated = await client.management.webhooks.update('webhook-uuid', {
|
|
2461
|
+
* events: ['user.created', 'user.deleted'],
|
|
2462
|
+
* is_active: false
|
|
2463
|
+
* })
|
|
2464
|
+
* ```
|
|
2465
|
+
*/
|
|
2466
|
+
update(webhookId: string, updates: UpdateWebhookRequest): Promise<Webhook>;
|
|
2467
|
+
/**
|
|
2468
|
+
* Delete a webhook
|
|
2469
|
+
*
|
|
2470
|
+
* @param webhookId - Webhook ID
|
|
2471
|
+
* @returns Deletion confirmation
|
|
2472
|
+
*
|
|
2473
|
+
* @example
|
|
2474
|
+
* ```typescript
|
|
2475
|
+
* await client.management.webhooks.delete('webhook-uuid')
|
|
2476
|
+
* console.log('Webhook deleted')
|
|
2477
|
+
* ```
|
|
2478
|
+
*/
|
|
2479
|
+
delete(webhookId: string): Promise<DeleteWebhookResponse>;
|
|
2480
|
+
/**
|
|
2481
|
+
* Test a webhook by sending a test payload
|
|
2482
|
+
*
|
|
2483
|
+
* @param webhookId - Webhook ID
|
|
2484
|
+
* @returns Test result with status and response
|
|
2485
|
+
*
|
|
2486
|
+
* @example
|
|
2487
|
+
* ```typescript
|
|
2488
|
+
* const result = await client.management.webhooks.test('webhook-uuid')
|
|
2489
|
+
*
|
|
2490
|
+
* if (result.success) {
|
|
2491
|
+
* console.log('Webhook test successful')
|
|
2492
|
+
* } else {
|
|
2493
|
+
* console.error('Webhook test failed:', result.error)
|
|
2494
|
+
* }
|
|
2495
|
+
* ```
|
|
2496
|
+
*/
|
|
2497
|
+
test(webhookId: string): Promise<TestWebhookResponse>;
|
|
2498
|
+
/**
|
|
2499
|
+
* List webhook delivery history
|
|
2500
|
+
*
|
|
2501
|
+
* @param webhookId - Webhook ID
|
|
2502
|
+
* @param limit - Maximum number of deliveries to return (default: 50)
|
|
2503
|
+
* @returns List of webhook deliveries
|
|
2504
|
+
*
|
|
2505
|
+
* @example
|
|
2506
|
+
* ```typescript
|
|
2507
|
+
* const { deliveries } = await client.management.webhooks.listDeliveries('webhook-uuid', 100)
|
|
2508
|
+
*
|
|
2509
|
+
* deliveries.forEach(delivery => {
|
|
2510
|
+
* console.log(`Event: ${delivery.event}, Status: ${delivery.status_code}`)
|
|
2511
|
+
* })
|
|
2512
|
+
* ```
|
|
2513
|
+
*/
|
|
2514
|
+
listDeliveries(webhookId: string, limit?: number): Promise<ListWebhookDeliveriesResponse>;
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Invitations management client
|
|
2518
|
+
*
|
|
2519
|
+
* Provides methods for creating and managing user invitations.
|
|
2520
|
+
* Invitations allow admins to invite new users to join the dashboard.
|
|
2521
|
+
*
|
|
2522
|
+
* @example
|
|
2523
|
+
* ```typescript
|
|
2524
|
+
* const client = createClient({ url: 'http://localhost:8080' })
|
|
2525
|
+
* await client.admin.login({ email: 'admin@example.com', password: 'password' })
|
|
2526
|
+
*
|
|
2527
|
+
* // Create an invitation
|
|
2528
|
+
* const invitation = await client.management.invitations.create({
|
|
2529
|
+
* email: 'newuser@example.com',
|
|
2530
|
+
* role: 'dashboard_user'
|
|
2531
|
+
* })
|
|
2532
|
+
*
|
|
2533
|
+
* console.log('Invite link:', invitation.invite_link)
|
|
2534
|
+
* ```
|
|
2535
|
+
*
|
|
2536
|
+
* @category Management
|
|
2537
|
+
*/
|
|
2538
|
+
declare class InvitationsManager {
|
|
2539
|
+
private fetch;
|
|
2540
|
+
constructor(fetch: FluxbaseFetch);
|
|
2541
|
+
/**
|
|
2542
|
+
* Create a new invitation (admin only)
|
|
2543
|
+
*
|
|
2544
|
+
* @param request - Invitation details
|
|
2545
|
+
* @returns Created invitation with invite link
|
|
2546
|
+
*
|
|
2547
|
+
* @example
|
|
2548
|
+
* ```typescript
|
|
2549
|
+
* const invitation = await client.management.invitations.create({
|
|
2550
|
+
* email: 'newuser@example.com',
|
|
2551
|
+
* role: 'dashboard_user',
|
|
2552
|
+
* expiry_duration: 604800 // 7 days in seconds
|
|
2553
|
+
* })
|
|
2554
|
+
*
|
|
2555
|
+
* // Share the invite link
|
|
2556
|
+
* console.log('Send this link to the user:', invitation.invite_link)
|
|
2557
|
+
* ```
|
|
2558
|
+
*/
|
|
2559
|
+
create(request: CreateInvitationRequest): Promise<CreateInvitationResponse>;
|
|
2560
|
+
/**
|
|
2561
|
+
* List all invitations (admin only)
|
|
2562
|
+
*
|
|
2563
|
+
* @param options - Filter options
|
|
2564
|
+
* @returns List of invitations
|
|
2565
|
+
*
|
|
2566
|
+
* @example
|
|
2567
|
+
* ```typescript
|
|
2568
|
+
* // List pending invitations only
|
|
2569
|
+
* const { invitations } = await client.management.invitations.list({
|
|
2570
|
+
* include_accepted: false,
|
|
2571
|
+
* include_expired: false
|
|
2572
|
+
* })
|
|
2573
|
+
*
|
|
2574
|
+
* // List all invitations including accepted and expired
|
|
2575
|
+
* const all = await client.management.invitations.list({
|
|
2576
|
+
* include_accepted: true,
|
|
2577
|
+
* include_expired: true
|
|
2578
|
+
* })
|
|
2579
|
+
* ```
|
|
2580
|
+
*/
|
|
2581
|
+
list(options?: ListInvitationsOptions): Promise<ListInvitationsResponse>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Validate an invitation token (public endpoint)
|
|
2584
|
+
*
|
|
2585
|
+
* @param token - Invitation token
|
|
2586
|
+
* @returns Validation result with invitation details
|
|
2587
|
+
*
|
|
2588
|
+
* @example
|
|
2589
|
+
* ```typescript
|
|
2590
|
+
* const result = await client.management.invitations.validate('invitation-token')
|
|
2591
|
+
*
|
|
2592
|
+
* if (result.valid) {
|
|
2593
|
+
* console.log('Valid invitation for:', result.invitation?.email)
|
|
2594
|
+
* } else {
|
|
2595
|
+
* console.error('Invalid:', result.error)
|
|
2596
|
+
* }
|
|
2597
|
+
* ```
|
|
2598
|
+
*/
|
|
2599
|
+
validate(token: string): Promise<ValidateInvitationResponse>;
|
|
2600
|
+
/**
|
|
2601
|
+
* Accept an invitation and create a new user (public endpoint)
|
|
2602
|
+
*
|
|
2603
|
+
* @param token - Invitation token
|
|
2604
|
+
* @param request - User details (password and name)
|
|
2605
|
+
* @returns Created user with authentication tokens
|
|
2606
|
+
*
|
|
2607
|
+
* @example
|
|
2608
|
+
* ```typescript
|
|
2609
|
+
* const response = await client.management.invitations.accept('invitation-token', {
|
|
2610
|
+
* password: 'SecurePassword123!',
|
|
2611
|
+
* name: 'John Doe'
|
|
2612
|
+
* })
|
|
2613
|
+
*
|
|
2614
|
+
* // Store tokens
|
|
2615
|
+
* localStorage.setItem('access_token', response.access_token)
|
|
2616
|
+
* console.log('Welcome:', response.user.name)
|
|
2617
|
+
* ```
|
|
2618
|
+
*/
|
|
2619
|
+
accept(token: string, request: AcceptInvitationRequest): Promise<AcceptInvitationResponse>;
|
|
2620
|
+
/**
|
|
2621
|
+
* Revoke an invitation (admin only)
|
|
2622
|
+
*
|
|
2623
|
+
* @param token - Invitation token
|
|
2624
|
+
* @returns Revocation confirmation
|
|
2625
|
+
*
|
|
2626
|
+
* @example
|
|
2627
|
+
* ```typescript
|
|
2628
|
+
* await client.management.invitations.revoke('invitation-token')
|
|
2629
|
+
* console.log('Invitation revoked')
|
|
2630
|
+
* ```
|
|
2631
|
+
*/
|
|
2632
|
+
revoke(token: string): Promise<RevokeInvitationResponse>;
|
|
2633
|
+
}
|
|
2634
|
+
/**
|
|
2635
|
+
* Management client for API keys, webhooks, and invitations
|
|
2636
|
+
*
|
|
2637
|
+
* @category Management
|
|
2638
|
+
*/
|
|
2639
|
+
declare class FluxbaseManagement {
|
|
2640
|
+
/** API Keys management */
|
|
2641
|
+
apiKeys: APIKeysManager;
|
|
2642
|
+
/** Webhooks management */
|
|
2643
|
+
webhooks: WebhooksManager;
|
|
2644
|
+
/** Invitations management */
|
|
2645
|
+
invitations: InvitationsManager;
|
|
2646
|
+
constructor(fetch: FluxbaseFetch);
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
/**
|
|
2650
|
+
* Admin client for managing Fluxbase instance
|
|
2651
|
+
*/
|
|
2652
|
+
declare class FluxbaseAdmin {
|
|
2653
|
+
private fetch;
|
|
2654
|
+
private adminToken;
|
|
2655
|
+
/**
|
|
2656
|
+
* Settings manager for system and application settings
|
|
2657
|
+
*/
|
|
2658
|
+
settings: FluxbaseSettings;
|
|
2659
|
+
/**
|
|
2660
|
+
* DDL manager for database schema and table operations
|
|
2661
|
+
*/
|
|
2662
|
+
ddl: DDLManager;
|
|
2663
|
+
/**
|
|
2664
|
+
* OAuth configuration manager for provider and auth settings
|
|
2665
|
+
*/
|
|
2666
|
+
oauth: FluxbaseOAuth;
|
|
2667
|
+
/**
|
|
2668
|
+
* Impersonation manager for user impersonation and audit trail
|
|
2669
|
+
*/
|
|
2670
|
+
impersonation: ImpersonationManager;
|
|
2671
|
+
/**
|
|
2672
|
+
* Management namespace for API keys, webhooks, and invitations
|
|
2673
|
+
*/
|
|
2674
|
+
management: FluxbaseManagement;
|
|
2675
|
+
constructor(fetch: FluxbaseFetch);
|
|
2676
|
+
/**
|
|
2677
|
+
* Set admin authentication token
|
|
2678
|
+
*/
|
|
2679
|
+
setToken(token: string): void;
|
|
2680
|
+
/**
|
|
2681
|
+
* Get current admin token
|
|
2682
|
+
*/
|
|
2683
|
+
getToken(): string | null;
|
|
2684
|
+
/**
|
|
2685
|
+
* Clear admin token
|
|
2686
|
+
*/
|
|
2687
|
+
clearToken(): void;
|
|
2688
|
+
/**
|
|
2689
|
+
* Check if initial admin setup is needed
|
|
2690
|
+
*
|
|
2691
|
+
* @returns Setup status indicating if initial setup is required
|
|
2692
|
+
*
|
|
2693
|
+
* @example
|
|
2694
|
+
* ```typescript
|
|
2695
|
+
* const status = await admin.getSetupStatus();
|
|
2696
|
+
* if (status.needs_setup) {
|
|
2697
|
+
* console.log('Initial setup required');
|
|
2698
|
+
* }
|
|
2699
|
+
* ```
|
|
2700
|
+
*/
|
|
2701
|
+
getSetupStatus(): Promise<AdminSetupStatusResponse>;
|
|
2702
|
+
/**
|
|
2703
|
+
* Perform initial admin setup
|
|
2704
|
+
*
|
|
2705
|
+
* Creates the first admin user and completes initial setup.
|
|
2706
|
+
* This endpoint can only be called once.
|
|
2707
|
+
*
|
|
2708
|
+
* @param email - Admin email address
|
|
2709
|
+
* @param password - Admin password (minimum 12 characters)
|
|
2710
|
+
* @param name - Admin display name
|
|
2711
|
+
* @returns Authentication response with tokens
|
|
2712
|
+
*
|
|
2713
|
+
* @example
|
|
2714
|
+
* ```typescript
|
|
2715
|
+
* const response = await admin.setup({
|
|
2716
|
+
* email: 'admin@example.com',
|
|
2717
|
+
* password: 'SecurePassword123!',
|
|
2718
|
+
* name: 'Admin User'
|
|
2719
|
+
* });
|
|
2720
|
+
*
|
|
2721
|
+
* // Store tokens
|
|
2722
|
+
* localStorage.setItem('admin_token', response.access_token);
|
|
2723
|
+
* ```
|
|
2724
|
+
*/
|
|
2725
|
+
setup(request: AdminSetupRequest): Promise<AdminAuthResponse>;
|
|
2726
|
+
/**
|
|
2727
|
+
* Admin login
|
|
2728
|
+
*
|
|
2729
|
+
* Authenticate as an admin user
|
|
2730
|
+
*
|
|
2731
|
+
* @param email - Admin email
|
|
2732
|
+
* @param password - Admin password
|
|
2733
|
+
* @returns Authentication response with tokens
|
|
2734
|
+
*
|
|
2735
|
+
* @example
|
|
2736
|
+
* ```typescript
|
|
2737
|
+
* const response = await admin.login({
|
|
2738
|
+
* email: 'admin@example.com',
|
|
2739
|
+
* password: 'password123'
|
|
2740
|
+
* });
|
|
2741
|
+
*
|
|
2742
|
+
* // Token is automatically set in the client
|
|
2743
|
+
* console.log('Logged in as:', response.user.email);
|
|
2744
|
+
* ```
|
|
2745
|
+
*/
|
|
2746
|
+
login(request: AdminLoginRequest): Promise<AdminAuthResponse>;
|
|
2747
|
+
/**
|
|
2748
|
+
* Refresh admin access token
|
|
2749
|
+
*
|
|
2750
|
+
* @param refreshToken - Refresh token
|
|
2751
|
+
* @returns New access and refresh tokens
|
|
2752
|
+
*
|
|
2753
|
+
* @example
|
|
2754
|
+
* ```typescript
|
|
2755
|
+
* const refreshToken = localStorage.getItem('admin_refresh_token');
|
|
2756
|
+
* const response = await admin.refreshToken({ refresh_token: refreshToken });
|
|
2757
|
+
*
|
|
2758
|
+
* // Update stored tokens
|
|
2759
|
+
* localStorage.setItem('admin_token', response.access_token);
|
|
2760
|
+
* localStorage.setItem('admin_refresh_token', response.refresh_token);
|
|
2761
|
+
* ```
|
|
2762
|
+
*/
|
|
2763
|
+
refreshToken(request: AdminRefreshRequest): Promise<AdminRefreshResponse>;
|
|
2764
|
+
/**
|
|
2765
|
+
* Admin logout
|
|
2766
|
+
*
|
|
2767
|
+
* Invalidates the current admin session
|
|
2768
|
+
*
|
|
2769
|
+
* @example
|
|
2770
|
+
* ```typescript
|
|
2771
|
+
* await admin.logout();
|
|
2772
|
+
* localStorage.removeItem('admin_token');
|
|
2773
|
+
* ```
|
|
2774
|
+
*/
|
|
2775
|
+
logout(): Promise<void>;
|
|
2776
|
+
/**
|
|
2777
|
+
* Get current admin user information
|
|
2778
|
+
*
|
|
2779
|
+
* @returns Current admin user details
|
|
2780
|
+
*
|
|
2781
|
+
* @example
|
|
2782
|
+
* ```typescript
|
|
2783
|
+
* const { user } = await admin.me();
|
|
2784
|
+
* console.log('Logged in as:', user.email);
|
|
2785
|
+
* console.log('Role:', user.role);
|
|
2786
|
+
* ```
|
|
2787
|
+
*/
|
|
2788
|
+
me(): Promise<AdminMeResponse>;
|
|
2789
|
+
/**
|
|
2790
|
+
* List all users
|
|
2791
|
+
*
|
|
2792
|
+
* @param options - Filter and pagination options
|
|
2793
|
+
* @returns List of users with metadata
|
|
2794
|
+
*
|
|
2795
|
+
* @example
|
|
2796
|
+
* ```typescript
|
|
2797
|
+
* // List all users
|
|
2798
|
+
* const { users, total } = await admin.listUsers();
|
|
2799
|
+
*
|
|
2800
|
+
* // List with filters
|
|
2801
|
+
* const result = await admin.listUsers({
|
|
2802
|
+
* exclude_admins: true,
|
|
2803
|
+
* search: 'john',
|
|
2804
|
+
* limit: 50,
|
|
2805
|
+
* type: 'app'
|
|
2806
|
+
* });
|
|
2807
|
+
* ```
|
|
2808
|
+
*/
|
|
2809
|
+
listUsers(options?: ListUsersOptions): Promise<ListUsersResponse>;
|
|
2810
|
+
/**
|
|
2811
|
+
* Get a user by ID
|
|
2812
|
+
*
|
|
2813
|
+
* Fetch a single user's details by their user ID
|
|
2814
|
+
*
|
|
2815
|
+
* @param userId - User ID to fetch
|
|
2816
|
+
* @param type - User type ('app' or 'dashboard')
|
|
2817
|
+
* @returns User details with metadata
|
|
2818
|
+
*
|
|
2819
|
+
* @example
|
|
2820
|
+
* ```typescript
|
|
2821
|
+
* // Get an app user
|
|
2822
|
+
* const user = await admin.getUserById('user-123');
|
|
2823
|
+
*
|
|
2824
|
+
* // Get a dashboard user
|
|
2825
|
+
* const dashboardUser = await admin.getUserById('admin-456', 'dashboard');
|
|
2826
|
+
* console.log('User email:', dashboardUser.email);
|
|
2827
|
+
* console.log('Last login:', dashboardUser.last_login_at);
|
|
2828
|
+
* ```
|
|
2829
|
+
*/
|
|
2830
|
+
getUserById(userId: string, type?: "app" | "dashboard"): Promise<EnrichedUser>;
|
|
2831
|
+
/**
|
|
2832
|
+
* Invite a new user
|
|
2833
|
+
*
|
|
2834
|
+
* Creates a new user and optionally sends an invitation email
|
|
2835
|
+
*
|
|
2836
|
+
* @param request - User invitation details
|
|
2837
|
+
* @param type - User type ('app' or 'dashboard')
|
|
2838
|
+
* @returns Created user and invitation details
|
|
2839
|
+
*
|
|
2840
|
+
* @example
|
|
2841
|
+
* ```typescript
|
|
2842
|
+
* const response = await admin.inviteUser({
|
|
2843
|
+
* email: 'newuser@example.com',
|
|
2844
|
+
* role: 'user',
|
|
2845
|
+
* send_email: true
|
|
2846
|
+
* });
|
|
2847
|
+
*
|
|
2848
|
+
* console.log('User invited:', response.user.email);
|
|
2849
|
+
* console.log('Invitation link:', response.invitation_link);
|
|
2850
|
+
* ```
|
|
2851
|
+
*/
|
|
2852
|
+
inviteUser(request: InviteUserRequest, type?: "app" | "dashboard"): Promise<InviteUserResponse>;
|
|
2853
|
+
/**
|
|
2854
|
+
* Delete a user
|
|
2855
|
+
*
|
|
2856
|
+
* Permanently deletes a user and all associated data
|
|
2857
|
+
*
|
|
2858
|
+
* @param userId - User ID to delete
|
|
2859
|
+
* @param type - User type ('app' or 'dashboard')
|
|
2860
|
+
* @returns Deletion confirmation
|
|
2861
|
+
*
|
|
2862
|
+
* @example
|
|
2863
|
+
* ```typescript
|
|
2864
|
+
* await admin.deleteUser('user-uuid');
|
|
2865
|
+
* console.log('User deleted');
|
|
2866
|
+
* ```
|
|
2867
|
+
*/
|
|
2868
|
+
deleteUser(userId: string, type?: "app" | "dashboard"): Promise<DeleteUserResponse>;
|
|
2869
|
+
/**
|
|
2870
|
+
* Update user role
|
|
2871
|
+
*
|
|
2872
|
+
* Changes a user's role
|
|
2873
|
+
*
|
|
2874
|
+
* @param userId - User ID
|
|
2875
|
+
* @param role - New role
|
|
2876
|
+
* @param type - User type ('app' or 'dashboard')
|
|
2877
|
+
* @returns Updated user
|
|
2878
|
+
*
|
|
2879
|
+
* @example
|
|
2880
|
+
* ```typescript
|
|
2881
|
+
* const user = await admin.updateUserRole('user-uuid', 'admin');
|
|
2882
|
+
* console.log('User role updated:', user.role);
|
|
2883
|
+
* ```
|
|
2884
|
+
*/
|
|
2885
|
+
updateUserRole(userId: string, role: string, type?: "app" | "dashboard"): Promise<EnrichedUser>;
|
|
2886
|
+
/**
|
|
2887
|
+
* Reset user password
|
|
2888
|
+
*
|
|
2889
|
+
* Generates a new password for the user and optionally sends it via email
|
|
2890
|
+
*
|
|
2891
|
+
* @param userId - User ID
|
|
2892
|
+
* @param type - User type ('app' or 'dashboard')
|
|
2893
|
+
* @returns Reset confirmation message
|
|
2894
|
+
*
|
|
2895
|
+
* @example
|
|
2896
|
+
* ```typescript
|
|
2897
|
+
* const response = await admin.resetUserPassword('user-uuid');
|
|
2898
|
+
* console.log(response.message);
|
|
2899
|
+
* ```
|
|
2900
|
+
*/
|
|
2901
|
+
resetUserPassword(userId: string, type?: "app" | "dashboard"): Promise<ResetUserPasswordResponse>;
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
/**
|
|
2905
|
+
* PostgreSQL query builder for Fluxbase SDK
|
|
2906
|
+
* Inspired by Supabase's PostgREST client
|
|
2907
|
+
*/
|
|
2908
|
+
|
|
2909
|
+
declare class QueryBuilder<T = unknown> implements PromiseLike<PostgrestResponse<T>> {
|
|
2910
|
+
private fetch;
|
|
2911
|
+
private table;
|
|
2912
|
+
private selectQuery;
|
|
2913
|
+
private filters;
|
|
2914
|
+
private orderBys;
|
|
2915
|
+
private limitValue?;
|
|
2916
|
+
private offsetValue?;
|
|
2917
|
+
private singleRow;
|
|
2918
|
+
private groupByColumns?;
|
|
2919
|
+
constructor(fetch: FluxbaseFetch, table: string);
|
|
2920
|
+
/**
|
|
2921
|
+
* Select columns to return
|
|
2922
|
+
* @example select('*')
|
|
2923
|
+
* @example select('id, name, email')
|
|
2924
|
+
* @example select('id, name, posts(title, content)')
|
|
2925
|
+
*/
|
|
2926
|
+
select(columns?: string): this;
|
|
2927
|
+
/**
|
|
2928
|
+
* Insert a single row or multiple rows
|
|
2929
|
+
*/
|
|
2930
|
+
insert(data: Partial<T> | Array<Partial<T>>): Promise<PostgrestResponse<T>>;
|
|
2931
|
+
/**
|
|
2932
|
+
* Upsert (insert or update) rows
|
|
2933
|
+
*/
|
|
2934
|
+
upsert(data: Partial<T> | Array<Partial<T>>): Promise<PostgrestResponse<T>>;
|
|
2935
|
+
/**
|
|
2936
|
+
* Update rows matching the filters
|
|
2937
|
+
*/
|
|
2938
|
+
update(data: Partial<T>): Promise<PostgrestResponse<T>>;
|
|
2939
|
+
/**
|
|
2940
|
+
* Delete rows matching the filters
|
|
2941
|
+
*/
|
|
2942
|
+
delete(): Promise<PostgrestResponse<null>>;
|
|
2943
|
+
/**
|
|
2944
|
+
* Equal to
|
|
2945
|
+
*/
|
|
2946
|
+
eq(column: string, value: unknown): this;
|
|
2947
|
+
/**
|
|
2948
|
+
* Not equal to
|
|
2949
|
+
*/
|
|
2950
|
+
neq(column: string, value: unknown): this;
|
|
2951
|
+
/**
|
|
2952
|
+
* Greater than
|
|
2953
|
+
*/
|
|
2954
|
+
gt(column: string, value: unknown): this;
|
|
2955
|
+
/**
|
|
2956
|
+
* Greater than or equal to
|
|
2957
|
+
*/
|
|
2958
|
+
gte(column: string, value: unknown): this;
|
|
2959
|
+
/**
|
|
2960
|
+
* Less than
|
|
2961
|
+
*/
|
|
2962
|
+
lt(column: string, value: unknown): this;
|
|
2963
|
+
/**
|
|
2964
|
+
* Less than or equal to
|
|
2965
|
+
*/
|
|
2966
|
+
lte(column: string, value: unknown): this;
|
|
2967
|
+
/**
|
|
2968
|
+
* Pattern matching (case-sensitive)
|
|
2969
|
+
*/
|
|
2970
|
+
like(column: string, pattern: string): this;
|
|
2971
|
+
/**
|
|
2972
|
+
* Pattern matching (case-insensitive)
|
|
2973
|
+
*/
|
|
2974
|
+
ilike(column: string, pattern: string): this;
|
|
2975
|
+
/**
|
|
2976
|
+
* Check if value is null or not null
|
|
2977
|
+
*/
|
|
2978
|
+
is(column: string, value: null | boolean): this;
|
|
2979
|
+
/**
|
|
2980
|
+
* Check if value is in array
|
|
2981
|
+
*/
|
|
2982
|
+
in(column: string, values: unknown[]): this;
|
|
2983
|
+
/**
|
|
2984
|
+
* Contains (for arrays and JSONB)
|
|
2985
|
+
*/
|
|
2986
|
+
contains(column: string, value: unknown): this;
|
|
2987
|
+
/**
|
|
2988
|
+
* Full-text search
|
|
2989
|
+
*/
|
|
2990
|
+
textSearch(column: string, query: string): this;
|
|
2991
|
+
/**
|
|
2992
|
+
* Order results
|
|
2993
|
+
*/
|
|
2994
|
+
order(column: string, options?: {
|
|
2995
|
+
ascending?: boolean;
|
|
2996
|
+
nullsFirst?: boolean;
|
|
2997
|
+
}): this;
|
|
2998
|
+
/**
|
|
2999
|
+
* Limit number of rows returned
|
|
3000
|
+
*/
|
|
3001
|
+
limit(count: number): this;
|
|
3002
|
+
/**
|
|
3003
|
+
* Skip rows
|
|
3004
|
+
*/
|
|
3005
|
+
offset(count: number): this;
|
|
3006
|
+
/**
|
|
3007
|
+
* Return a single row (adds limit(1))
|
|
3008
|
+
*/
|
|
3009
|
+
single(): this;
|
|
3010
|
+
/**
|
|
3011
|
+
* Range selection (pagination)
|
|
3012
|
+
*/
|
|
3013
|
+
range(from: number, to: number): this;
|
|
3014
|
+
/**
|
|
3015
|
+
* Group results by one or more columns (for use with aggregations)
|
|
3016
|
+
*
|
|
3017
|
+
* @param columns - Column name(s) to group by
|
|
3018
|
+
* @returns Query builder for chaining
|
|
3019
|
+
*
|
|
3020
|
+
* @example
|
|
3021
|
+
* ```typescript
|
|
3022
|
+
* // Group by single column
|
|
3023
|
+
* const { data } = await client.from('orders')
|
|
3024
|
+
* .count('*')
|
|
3025
|
+
* .groupBy('status')
|
|
3026
|
+
* .execute()
|
|
3027
|
+
*
|
|
3028
|
+
* // Group by multiple columns
|
|
3029
|
+
* const { data } = await client.from('sales')
|
|
3030
|
+
* .sum('amount')
|
|
3031
|
+
* .groupBy(['region', 'product_category'])
|
|
3032
|
+
* .execute()
|
|
3033
|
+
* ```
|
|
3034
|
+
*
|
|
3035
|
+
* @category Aggregation
|
|
3036
|
+
*/
|
|
3037
|
+
groupBy(columns: string | string[]): this;
|
|
3038
|
+
/**
|
|
3039
|
+
* Count rows or a specific column
|
|
3040
|
+
*
|
|
3041
|
+
* @param column - Column to count (default: '*' for row count)
|
|
3042
|
+
* @returns Query builder for chaining
|
|
3043
|
+
*
|
|
3044
|
+
* @example
|
|
3045
|
+
* ```typescript
|
|
3046
|
+
* // Count all rows
|
|
3047
|
+
* const { data } = await client.from('users').count().execute()
|
|
3048
|
+
* // Returns: { count: 150 }
|
|
3049
|
+
*
|
|
3050
|
+
* // Count non-null values in a column
|
|
3051
|
+
* const { data } = await client.from('orders').count('completed_at').execute()
|
|
3052
|
+
*
|
|
3053
|
+
* // Count with grouping
|
|
3054
|
+
* const { data } = await client.from('products')
|
|
3055
|
+
* .count('*')
|
|
3056
|
+
* .groupBy('category')
|
|
3057
|
+
* .execute()
|
|
3058
|
+
* // Returns: [{ category: 'electronics', count: 45 }, { category: 'books', count: 23 }]
|
|
3059
|
+
* ```
|
|
3060
|
+
*
|
|
3061
|
+
* @category Aggregation
|
|
3062
|
+
*/
|
|
3063
|
+
count(column?: string): this;
|
|
3064
|
+
/**
|
|
3065
|
+
* Calculate the sum of a numeric column
|
|
3066
|
+
*
|
|
3067
|
+
* @param column - Column to sum
|
|
3068
|
+
* @returns Query builder for chaining
|
|
3069
|
+
*
|
|
3070
|
+
* @example
|
|
3071
|
+
* ```typescript
|
|
3072
|
+
* // Sum all prices
|
|
3073
|
+
* const { data } = await client.from('products').sum('price').execute()
|
|
3074
|
+
* // Returns: { sum_price: 15420.50 }
|
|
3075
|
+
*
|
|
3076
|
+
* // Sum by category
|
|
3077
|
+
* const { data } = await client.from('orders')
|
|
3078
|
+
* .sum('total')
|
|
3079
|
+
* .groupBy('status')
|
|
3080
|
+
* .execute()
|
|
3081
|
+
* // Returns: [{ status: 'completed', sum_total: 12500 }, { status: 'pending', sum_total: 3200 }]
|
|
3082
|
+
* ```
|
|
3083
|
+
*
|
|
3084
|
+
* @category Aggregation
|
|
3085
|
+
*/
|
|
3086
|
+
sum(column: string): this;
|
|
3087
|
+
/**
|
|
3088
|
+
* Calculate the average of a numeric column
|
|
3089
|
+
*
|
|
3090
|
+
* @param column - Column to average
|
|
3091
|
+
* @returns Query builder for chaining
|
|
3092
|
+
*
|
|
3093
|
+
* @example
|
|
3094
|
+
* ```typescript
|
|
3095
|
+
* // Average price
|
|
3096
|
+
* const { data } = await client.from('products').avg('price').execute()
|
|
3097
|
+
* // Returns: { avg_price: 129.99 }
|
|
3098
|
+
*
|
|
3099
|
+
* // Average by category
|
|
3100
|
+
* const { data } = await client.from('products')
|
|
3101
|
+
* .avg('price')
|
|
3102
|
+
* .groupBy('category')
|
|
3103
|
+
* .execute()
|
|
3104
|
+
* ```
|
|
3105
|
+
*
|
|
3106
|
+
* @category Aggregation
|
|
3107
|
+
*/
|
|
3108
|
+
avg(column: string): this;
|
|
3109
|
+
/**
|
|
3110
|
+
* Find the minimum value in a column
|
|
3111
|
+
*
|
|
3112
|
+
* @param column - Column to find minimum value
|
|
3113
|
+
* @returns Query builder for chaining
|
|
3114
|
+
*
|
|
3115
|
+
* @example
|
|
3116
|
+
* ```typescript
|
|
3117
|
+
* // Find lowest price
|
|
3118
|
+
* const { data } = await client.from('products').min('price').execute()
|
|
3119
|
+
* // Returns: { min_price: 9.99 }
|
|
3120
|
+
*
|
|
3121
|
+
* // Find earliest date
|
|
3122
|
+
* const { data } = await client.from('orders').min('created_at').execute()
|
|
3123
|
+
* ```
|
|
3124
|
+
*
|
|
3125
|
+
* @category Aggregation
|
|
3126
|
+
*/
|
|
3127
|
+
min(column: string): this;
|
|
3128
|
+
/**
|
|
3129
|
+
* Find the maximum value in a column
|
|
3130
|
+
*
|
|
3131
|
+
* @param column - Column to find maximum value
|
|
3132
|
+
* @returns Query builder for chaining
|
|
3133
|
+
*
|
|
3134
|
+
* @example
|
|
3135
|
+
* ```typescript
|
|
3136
|
+
* // Find highest price
|
|
3137
|
+
* const { data } = await client.from('products').max('price').execute()
|
|
3138
|
+
* // Returns: { max_price: 1999.99 }
|
|
3139
|
+
*
|
|
3140
|
+
* // Find most recent order
|
|
3141
|
+
* const { data } = await client.from('orders').max('created_at').execute()
|
|
3142
|
+
* ```
|
|
3143
|
+
*
|
|
3144
|
+
* @category Aggregation
|
|
3145
|
+
*/
|
|
3146
|
+
max(column: string): this;
|
|
3147
|
+
/**
|
|
3148
|
+
* Insert multiple rows in a single request (batch insert)
|
|
3149
|
+
*
|
|
3150
|
+
* This is a convenience method that explicitly shows intent for batch operations.
|
|
3151
|
+
* Internally calls `insert()` with an array.
|
|
3152
|
+
*
|
|
3153
|
+
* @param rows - Array of row objects to insert
|
|
3154
|
+
* @returns Promise with the inserted rows
|
|
3155
|
+
*
|
|
3156
|
+
* @example
|
|
3157
|
+
* ```typescript
|
|
3158
|
+
* // Insert multiple users at once
|
|
3159
|
+
* const { data } = await client.from('users').insertMany([
|
|
3160
|
+
* { name: 'Alice', email: 'alice@example.com' },
|
|
3161
|
+
* { name: 'Bob', email: 'bob@example.com' },
|
|
3162
|
+
* { name: 'Charlie', email: 'charlie@example.com' }
|
|
3163
|
+
* ]).execute()
|
|
3164
|
+
* ```
|
|
3165
|
+
*
|
|
3166
|
+
* @category Batch Operations
|
|
3167
|
+
*/
|
|
3168
|
+
insertMany(rows: Array<Partial<T>>): Promise<PostgrestResponse<T>>;
|
|
3169
|
+
/**
|
|
3170
|
+
* Update multiple rows matching the filters (batch update)
|
|
3171
|
+
*
|
|
3172
|
+
* Updates all rows that match the current query filters.
|
|
3173
|
+
* This is a convenience method that explicitly shows intent for batch operations.
|
|
3174
|
+
*
|
|
3175
|
+
* @param data - Data to update matching rows with
|
|
3176
|
+
* @returns Promise with the updated rows
|
|
3177
|
+
*
|
|
3178
|
+
* @example
|
|
3179
|
+
* ```typescript
|
|
3180
|
+
* // Apply discount to all electronics
|
|
3181
|
+
* const { data } = await client.from('products')
|
|
3182
|
+
* .eq('category', 'electronics')
|
|
3183
|
+
* .updateMany({ discount: 10, updated_at: new Date() })
|
|
3184
|
+
* .execute()
|
|
3185
|
+
*
|
|
3186
|
+
* // Mark all pending orders as processing
|
|
3187
|
+
* const { data } = await client.from('orders')
|
|
3188
|
+
* .eq('status', 'pending')
|
|
3189
|
+
* .updateMany({ status: 'processing' })
|
|
3190
|
+
* .execute()
|
|
3191
|
+
* ```
|
|
3192
|
+
*
|
|
3193
|
+
* @category Batch Operations
|
|
3194
|
+
*/
|
|
3195
|
+
updateMany(data: Partial<T>): Promise<PostgrestResponse<T>>;
|
|
3196
|
+
/**
|
|
3197
|
+
* Delete multiple rows matching the filters (batch delete)
|
|
3198
|
+
*
|
|
3199
|
+
* Deletes all rows that match the current query filters.
|
|
3200
|
+
* This is a convenience method that explicitly shows intent for batch operations.
|
|
3201
|
+
*
|
|
3202
|
+
* @returns Promise confirming deletion
|
|
3203
|
+
*
|
|
3204
|
+
* @example
|
|
3205
|
+
* ```typescript
|
|
3206
|
+
* // Delete all inactive users
|
|
3207
|
+
* await client.from('users')
|
|
3208
|
+
* .eq('active', false)
|
|
3209
|
+
* .deleteMany()
|
|
3210
|
+
* .execute()
|
|
3211
|
+
*
|
|
3212
|
+
* // Delete old logs
|
|
3213
|
+
* await client.from('logs')
|
|
3214
|
+
* .lt('created_at', '2024-01-01')
|
|
3215
|
+
* .deleteMany()
|
|
3216
|
+
* .execute()
|
|
3217
|
+
* ```
|
|
3218
|
+
*
|
|
3219
|
+
* @category Batch Operations
|
|
3220
|
+
*/
|
|
3221
|
+
deleteMany(): Promise<PostgrestResponse<null>>;
|
|
3222
|
+
/**
|
|
3223
|
+
* Execute the query and return results
|
|
3224
|
+
*/
|
|
3225
|
+
execute(): Promise<PostgrestResponse<T>>;
|
|
3226
|
+
/**
|
|
3227
|
+
* Make QueryBuilder awaitable (implements PromiseLike)
|
|
3228
|
+
* This allows using `await client.from('table').select()` without calling `.execute()`
|
|
3229
|
+
*
|
|
3230
|
+
* @example
|
|
3231
|
+
* ```typescript
|
|
3232
|
+
* // Without .execute() (new way)
|
|
3233
|
+
* const { data } = await client.from('users').select('*')
|
|
3234
|
+
*
|
|
3235
|
+
* // With .execute() (old way, still supported)
|
|
3236
|
+
* const { data } = await client.from('users').select('*').execute()
|
|
3237
|
+
* ```
|
|
3238
|
+
*/
|
|
3239
|
+
then<TResult1 = PostgrestResponse<T>, TResult2 = never>(onfulfilled?: ((value: PostgrestResponse<T>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
3240
|
+
/**
|
|
3241
|
+
* Build the query string from filters, ordering, etc.
|
|
3242
|
+
*/
|
|
3243
|
+
private buildQueryString;
|
|
3244
|
+
/**
|
|
3245
|
+
* Format a value for the query string
|
|
3246
|
+
*/
|
|
3247
|
+
private formatValue;
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
/**
|
|
3251
|
+
* Main Fluxbase client for interacting with the Fluxbase backend.
|
|
3252
|
+
*
|
|
3253
|
+
* This client provides access to all Fluxbase features including:
|
|
3254
|
+
* - Database operations via PostgREST-compatible API
|
|
3255
|
+
* - Authentication and user management
|
|
3256
|
+
* - Real-time subscriptions via WebSockets
|
|
3257
|
+
* - File storage and management
|
|
3258
|
+
* - PostgreSQL function calls (RPC)
|
|
3259
|
+
*
|
|
3260
|
+
* @example
|
|
3261
|
+
* ```typescript
|
|
3262
|
+
* import { createClient } from '@fluxbase/sdk'
|
|
3263
|
+
*
|
|
3264
|
+
* const client = createClient({
|
|
3265
|
+
* url: 'http://localhost:8080',
|
|
3266
|
+
* auth: {
|
|
3267
|
+
* token: 'your-jwt-token',
|
|
3268
|
+
* autoRefresh: true
|
|
3269
|
+
* }
|
|
3270
|
+
* })
|
|
3271
|
+
*
|
|
3272
|
+
* // Query database
|
|
3273
|
+
* const { data } = await client.from('users').select('*').execute()
|
|
3274
|
+
*
|
|
3275
|
+
* // Subscribe to realtime changes
|
|
3276
|
+
* client.realtime.subscribe('users', (payload) => {
|
|
3277
|
+
* console.log('Change:', payload)
|
|
3278
|
+
* })
|
|
3279
|
+
* ```
|
|
3280
|
+
*
|
|
3281
|
+
* @category Client
|
|
3282
|
+
*/
|
|
3283
|
+
|
|
3284
|
+
/**
|
|
3285
|
+
* Main Fluxbase client class
|
|
3286
|
+
* @category Client
|
|
3287
|
+
*/
|
|
3288
|
+
declare class FluxbaseClient {
|
|
3289
|
+
/** Internal HTTP client for making requests */
|
|
3290
|
+
private fetch;
|
|
3291
|
+
/** Authentication module for user management */
|
|
3292
|
+
auth: FluxbaseAuth;
|
|
3293
|
+
/** Realtime module for WebSocket subscriptions */
|
|
3294
|
+
realtime: FluxbaseRealtime;
|
|
3295
|
+
/** Storage module for file operations */
|
|
3296
|
+
storage: FluxbaseStorage;
|
|
3297
|
+
/** Admin module for instance management (requires admin authentication) */
|
|
3298
|
+
admin: FluxbaseAdmin;
|
|
3299
|
+
/** Management module for API keys, webhooks, and invitations */
|
|
3300
|
+
management: FluxbaseManagement;
|
|
3301
|
+
/**
|
|
3302
|
+
* Create a new Fluxbase client instance
|
|
3303
|
+
* @param options - Client configuration options
|
|
3304
|
+
*/
|
|
3305
|
+
constructor(options: FluxbaseClientOptions);
|
|
3306
|
+
/**
|
|
3307
|
+
* Create a query builder for a database table
|
|
3308
|
+
*
|
|
3309
|
+
* @param table - The table name (can include schema, e.g., 'public.users')
|
|
3310
|
+
* @returns A query builder instance for constructing and executing queries
|
|
3311
|
+
*
|
|
3312
|
+
* @example
|
|
3313
|
+
* ```typescript
|
|
3314
|
+
* // Simple select
|
|
3315
|
+
* const { data } = await client.from('users').select('*').execute()
|
|
3316
|
+
*
|
|
3317
|
+
* // With filters
|
|
3318
|
+
* const { data } = await client.from('products')
|
|
3319
|
+
* .select('id, name, price')
|
|
3320
|
+
* .gt('price', 100)
|
|
3321
|
+
* .eq('category', 'electronics')
|
|
3322
|
+
* .execute()
|
|
3323
|
+
*
|
|
3324
|
+
* // Insert
|
|
3325
|
+
* await client.from('users').insert({ name: 'John', email: 'john@example.com' }).execute()
|
|
3326
|
+
* ```
|
|
3327
|
+
*
|
|
3328
|
+
* @category Database
|
|
3329
|
+
*/
|
|
3330
|
+
from<T = any>(table: string): QueryBuilder<T>;
|
|
3331
|
+
/**
|
|
3332
|
+
* Call a PostgreSQL function (Remote Procedure Call)
|
|
3333
|
+
*
|
|
3334
|
+
* @param functionName - The name of the PostgreSQL function to call
|
|
3335
|
+
* @param params - Optional parameters to pass to the function
|
|
3336
|
+
* @returns Promise containing the function result or error
|
|
3337
|
+
*
|
|
3338
|
+
* @example
|
|
3339
|
+
* ```typescript
|
|
3340
|
+
* // Call a function without parameters
|
|
3341
|
+
* const { data, error } = await client.rpc('get_total_users')
|
|
3342
|
+
*
|
|
3343
|
+
* // Call a function with parameters
|
|
3344
|
+
* const { data, error } = await client.rpc('calculate_discount', {
|
|
3345
|
+
* product_id: 123,
|
|
3346
|
+
* coupon_code: 'SAVE20'
|
|
3347
|
+
* })
|
|
3348
|
+
* ```
|
|
3349
|
+
*
|
|
3350
|
+
* @category Database
|
|
3351
|
+
*/
|
|
3352
|
+
rpc<T = any>(functionName: string, params?: Record<string, unknown>): Promise<{
|
|
3353
|
+
data: T | null;
|
|
3354
|
+
error: Error | null;
|
|
3355
|
+
}>;
|
|
3356
|
+
/**
|
|
3357
|
+
* Sync auth state with realtime connections
|
|
3358
|
+
* @internal
|
|
3359
|
+
*/
|
|
3360
|
+
private setupAuthSync;
|
|
3361
|
+
/**
|
|
3362
|
+
* Get the current authentication token
|
|
3363
|
+
*
|
|
3364
|
+
* @returns The current JWT access token, or null if not authenticated
|
|
3365
|
+
*
|
|
3366
|
+
* @category Authentication
|
|
3367
|
+
*/
|
|
3368
|
+
getAuthToken(): string | null;
|
|
3369
|
+
/**
|
|
3370
|
+
* Set a new authentication token
|
|
3371
|
+
*
|
|
3372
|
+
* This updates both the HTTP client and realtime connection with the new token.
|
|
3373
|
+
*
|
|
3374
|
+
* @param token - The JWT access token to set, or null to clear authentication
|
|
3375
|
+
*
|
|
3376
|
+
* @category Authentication
|
|
3377
|
+
*/
|
|
3378
|
+
setAuthToken(token: string | null): void;
|
|
3379
|
+
/**
|
|
3380
|
+
* Get the internal HTTP client
|
|
3381
|
+
*
|
|
3382
|
+
* Use this for advanced scenarios like making custom API calls or admin operations.
|
|
3383
|
+
*
|
|
3384
|
+
* @returns The internal FluxbaseFetch instance
|
|
3385
|
+
*
|
|
3386
|
+
* @example
|
|
3387
|
+
* ```typescript
|
|
3388
|
+
* // Make a custom API call
|
|
3389
|
+
* const data = await client.http.get('/api/custom-endpoint')
|
|
3390
|
+
* ```
|
|
3391
|
+
*
|
|
3392
|
+
* @category Advanced
|
|
3393
|
+
*/
|
|
3394
|
+
get http(): FluxbaseFetch;
|
|
3395
|
+
}
|
|
3396
|
+
/**
|
|
3397
|
+
* Create a new Fluxbase client instance
|
|
3398
|
+
*
|
|
3399
|
+
* This is the recommended way to initialize the Fluxbase SDK.
|
|
3400
|
+
*
|
|
3401
|
+
* @param options - Client configuration options
|
|
3402
|
+
* @returns A configured Fluxbase client instance
|
|
3403
|
+
*
|
|
3404
|
+
* @example
|
|
3405
|
+
* ```typescript
|
|
3406
|
+
* import { createClient } from '@fluxbase/sdk'
|
|
3407
|
+
*
|
|
3408
|
+
* const client = createClient({
|
|
3409
|
+
* url: 'http://localhost:8080',
|
|
3410
|
+
* auth: {
|
|
3411
|
+
* token: 'your-jwt-token',
|
|
3412
|
+
* autoRefresh: true,
|
|
3413
|
+
* persist: true
|
|
3414
|
+
* },
|
|
3415
|
+
* timeout: 30000,
|
|
3416
|
+
* debug: false
|
|
3417
|
+
* })
|
|
3418
|
+
* ```
|
|
3419
|
+
*
|
|
3420
|
+
* @category Client
|
|
3421
|
+
*/
|
|
3422
|
+
declare function createClient(options: FluxbaseClientOptions): FluxbaseClient;
|
|
3423
|
+
|
|
3424
|
+
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 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 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 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 Schema, type SecuritySettings, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type SystemSetting, SystemSettingsManager, type Table, type TestWebhookResponse, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateSystemSettingRequest, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type User, type ValidateInvitationResponse, type Webhook, type WebhookDelivery, WebhooksManager, createClient };
|