@giaeulate/baas-sdk 1.0.10 → 1.1.1
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/package.json +37 -37
- package/dist/index.cjs +0 -1628
- package/dist/index.d.cts +0 -826
- package/dist/index.d.ts +0 -826
- package/dist/index.js +0 -1599
package/dist/index.d.cts
DELETED
|
@@ -1,826 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SDK Shared Types
|
|
3
|
-
*/
|
|
4
|
-
/** HTTP method types */
|
|
5
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
6
|
-
/** Request options for the HTTP client */
|
|
7
|
-
interface RequestOptions {
|
|
8
|
-
method?: HttpMethod;
|
|
9
|
-
body?: unknown;
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
skipAuth?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/** Query filter for data operations */
|
|
14
|
-
type QueryFilter = {
|
|
15
|
-
column: string;
|
|
16
|
-
operator: string;
|
|
17
|
-
value: any;
|
|
18
|
-
};
|
|
19
|
-
/** Pagination options */
|
|
20
|
-
interface PaginationOptions {
|
|
21
|
-
limit?: number;
|
|
22
|
-
offset?: number;
|
|
23
|
-
}
|
|
24
|
-
/** Generic API response with error */
|
|
25
|
-
interface ApiResponse<T = any> {
|
|
26
|
-
data?: T;
|
|
27
|
-
error?: string;
|
|
28
|
-
success?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/** Realtime Event types */
|
|
31
|
-
type RealtimeAction = 'INSERT' | 'UPDATE' | 'DELETE' | '*';
|
|
32
|
-
/** Structure of a Realtime event payload */
|
|
33
|
-
interface RealtimePayload<T = any> {
|
|
34
|
-
table: string;
|
|
35
|
-
action: 'insert' | 'update' | 'delete';
|
|
36
|
-
record: T;
|
|
37
|
-
old_record?: T;
|
|
38
|
-
timestamp: string;
|
|
39
|
-
}
|
|
40
|
-
/** Callback function for realtime subscriptions */
|
|
41
|
-
type RealtimeCallback<T = any> = (payload: RealtimePayload<T>) => void;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Core HTTP Client
|
|
45
|
-
* Base class providing HTTP request infrastructure for all SDK modules
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
declare class HttpClient {
|
|
49
|
-
url: string;
|
|
50
|
-
apiKey: string;
|
|
51
|
-
token: string | null;
|
|
52
|
-
private environment;
|
|
53
|
-
private _onForceLogout;
|
|
54
|
-
constructor(url?: string, apiKey?: string);
|
|
55
|
-
/**
|
|
56
|
-
* Set the auth token manually (e.g. restoring from SecureStore in React Native).
|
|
57
|
-
* Persists to both the in-memory property and localStorage so getDynamicToken() works.
|
|
58
|
-
*/
|
|
59
|
-
setToken(token: string | null): void;
|
|
60
|
-
/**
|
|
61
|
-
* Register a callback invoked on forced logout (401).
|
|
62
|
-
* Use this in React Native instead of the default window.location redirect.
|
|
63
|
-
*/
|
|
64
|
-
onForceLogout(callback: () => void): void;
|
|
65
|
-
protected cleanValue(val: string | null): string | null;
|
|
66
|
-
/**
|
|
67
|
-
* Public header generator for adapters
|
|
68
|
-
*/
|
|
69
|
-
getHeaders(contentType?: string): Record<string, string>;
|
|
70
|
-
getDynamicToken(): string | null;
|
|
71
|
-
/**
|
|
72
|
-
* Core HTTP request method - DRY principle
|
|
73
|
-
*/
|
|
74
|
-
protected request<T = any>(endpoint: string, options?: RequestOptions): Promise<T>;
|
|
75
|
-
protected get<T = any>(endpoint: string): Promise<T>;
|
|
76
|
-
protected post<T = any>(endpoint: string, body?: unknown): Promise<T>;
|
|
77
|
-
protected put<T = any>(endpoint: string, body?: unknown): Promise<T>;
|
|
78
|
-
protected patch<T = any>(endpoint: string, body?: unknown): Promise<T>;
|
|
79
|
-
protected delete<T = any>(endpoint: string): Promise<T>;
|
|
80
|
-
setEnvironment(env: string): void;
|
|
81
|
-
getEnvironment(): string;
|
|
82
|
-
logout(): void;
|
|
83
|
-
forceLogout(): void;
|
|
84
|
-
handleIPBlocked(ip?: string): void;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Environments Module - Test/Prod environment management
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
interface EnvironmentStatus {
|
|
92
|
-
test_exists: boolean;
|
|
93
|
-
test_status?: string;
|
|
94
|
-
test_created_at?: string;
|
|
95
|
-
test_schema_name?: string;
|
|
96
|
-
prod_schema_name: string;
|
|
97
|
-
table_count: number;
|
|
98
|
-
}
|
|
99
|
-
interface PromoteResult {
|
|
100
|
-
tables_promoted: number;
|
|
101
|
-
status: string;
|
|
102
|
-
}
|
|
103
|
-
interface EnvironmentsModule {
|
|
104
|
-
status(): Promise<EnvironmentStatus>;
|
|
105
|
-
init(): Promise<any>;
|
|
106
|
-
promote(): Promise<PromoteResult>;
|
|
107
|
-
revert(): Promise<any>;
|
|
108
|
-
setActive(env: 'test' | 'prod'): void;
|
|
109
|
-
getActive(): string;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* QueryBuilder - Fluent API for data queries
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
declare class QueryBuilder {
|
|
117
|
-
private table;
|
|
118
|
-
private url;
|
|
119
|
-
private client;
|
|
120
|
-
private queryParams;
|
|
121
|
-
private filters;
|
|
122
|
-
constructor(table: string, url: string, client: HttpClient);
|
|
123
|
-
select(columns?: string): this;
|
|
124
|
-
eq(column: string, value: any): this;
|
|
125
|
-
neq(column: string, value: any): this;
|
|
126
|
-
gt(column: string, value: any): this;
|
|
127
|
-
gte(column: string, value: any): this;
|
|
128
|
-
lt(column: string, value: any): this;
|
|
129
|
-
lte(column: string, value: any): this;
|
|
130
|
-
like(column: string, value: any): this;
|
|
131
|
-
ilike(column: string, value: any): this;
|
|
132
|
-
is(column: string, value: any): this;
|
|
133
|
-
in(column: string, values: any[]): this;
|
|
134
|
-
not(column: string, operator: string, value: any): this;
|
|
135
|
-
or(filters: string): this;
|
|
136
|
-
order(column: string, { ascending }?: {
|
|
137
|
-
ascending?: boolean | undefined;
|
|
138
|
-
}): this;
|
|
139
|
-
limit(count: number): this;
|
|
140
|
-
offset(count: number): this;
|
|
141
|
-
get(): Promise<{
|
|
142
|
-
data: null;
|
|
143
|
-
error: any;
|
|
144
|
-
status: number;
|
|
145
|
-
} | {
|
|
146
|
-
data: any;
|
|
147
|
-
error: null;
|
|
148
|
-
status: number;
|
|
149
|
-
}>;
|
|
150
|
-
insert(data: any): Promise<{
|
|
151
|
-
data: null;
|
|
152
|
-
error: any;
|
|
153
|
-
status: number;
|
|
154
|
-
} | {
|
|
155
|
-
data: any;
|
|
156
|
-
error: null;
|
|
157
|
-
status: number;
|
|
158
|
-
}>;
|
|
159
|
-
update(id: string | number, data: any): Promise<{
|
|
160
|
-
data: null;
|
|
161
|
-
error: any;
|
|
162
|
-
status: number;
|
|
163
|
-
} | {
|
|
164
|
-
data: any;
|
|
165
|
-
error: null;
|
|
166
|
-
status: number;
|
|
167
|
-
}>;
|
|
168
|
-
delete(id: string | number): Promise<{
|
|
169
|
-
data: null;
|
|
170
|
-
error: any;
|
|
171
|
-
status: number;
|
|
172
|
-
} | {
|
|
173
|
-
data: any;
|
|
174
|
-
error: null;
|
|
175
|
-
status: number;
|
|
176
|
-
} | {
|
|
177
|
-
success: boolean;
|
|
178
|
-
}>;
|
|
179
|
-
private getHeaders;
|
|
180
|
-
private handleResponse;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Auth Module - Authentication operations
|
|
185
|
-
*/
|
|
186
|
-
|
|
187
|
-
interface MFASetupResponse {
|
|
188
|
-
secret: string;
|
|
189
|
-
qr_code_url: string;
|
|
190
|
-
recovery_codes: string[];
|
|
191
|
-
}
|
|
192
|
-
interface AuthModule {
|
|
193
|
-
login(email: string, password: string): Promise<any>;
|
|
194
|
-
logout(): Promise<void>;
|
|
195
|
-
verifyMFA(mfaToken: string, code: string): Promise<any>;
|
|
196
|
-
verifyMFAWithRecoveryCode(mfaToken: string, recoveryCode: string): Promise<any>;
|
|
197
|
-
setupMFA(): Promise<MFASetupResponse>;
|
|
198
|
-
enableMFA(secret: string, code: string, recoveryCodes?: string[]): Promise<any>;
|
|
199
|
-
disableMFA(code: string): Promise<any>;
|
|
200
|
-
getProfile(): Promise<any>;
|
|
201
|
-
register(email: string, password: string): Promise<any>;
|
|
202
|
-
forgotPassword(email: string): Promise<any>;
|
|
203
|
-
resetPassword(token: string, newPassword: string): Promise<any>;
|
|
204
|
-
validateResetToken(token: string): Promise<any>;
|
|
205
|
-
verifyEmail(token: string): Promise<any>;
|
|
206
|
-
requestEmailVerification(): Promise<any>;
|
|
207
|
-
getAuthProviders(): Promise<any>;
|
|
208
|
-
getAuthProvider(provider: string): Promise<any>;
|
|
209
|
-
configureAuthProvider(provider: string, clientID: string, clientSecret: string, enabled: boolean): Promise<any>;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Users Module - User management operations
|
|
214
|
-
*/
|
|
215
|
-
|
|
216
|
-
interface UsersModule {
|
|
217
|
-
list(limit?: number, offset?: number): Promise<any>;
|
|
218
|
-
update(id: string, updates: {
|
|
219
|
-
email?: string;
|
|
220
|
-
role?: string;
|
|
221
|
-
email_verified?: boolean;
|
|
222
|
-
}): Promise<any>;
|
|
223
|
-
delete(id: string): Promise<any>;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Database Module - Schema, table, and column operations
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
|
-
interface DatabaseModule {
|
|
231
|
-
getSchemas(options?: {
|
|
232
|
-
search?: string;
|
|
233
|
-
limit?: number;
|
|
234
|
-
offset?: number;
|
|
235
|
-
}): Promise<any>;
|
|
236
|
-
getSchema(name: string): Promise<any>;
|
|
237
|
-
createTable(tableName: string, definition: Record<string, string | {
|
|
238
|
-
type: string;
|
|
239
|
-
nullable?: boolean;
|
|
240
|
-
unique?: boolean;
|
|
241
|
-
default?: string;
|
|
242
|
-
}>): Promise<any>;
|
|
243
|
-
dropTable(tableName: string): Promise<any>;
|
|
244
|
-
renameTable(tableName: string, newName: string): Promise<any>;
|
|
245
|
-
addColumn(tableName: string, column: {
|
|
246
|
-
name: string;
|
|
247
|
-
type: string;
|
|
248
|
-
nullable?: boolean;
|
|
249
|
-
default_value?: string;
|
|
250
|
-
}): Promise<any>;
|
|
251
|
-
dropColumn(tableName: string, columnName: string): Promise<any>;
|
|
252
|
-
modifyColumn(tableName: string, columnName: string, changes: {
|
|
253
|
-
type: string;
|
|
254
|
-
nullable?: boolean;
|
|
255
|
-
}): Promise<any>;
|
|
256
|
-
renameColumn(tableName: string, columnName: string, newName: string): Promise<any>;
|
|
257
|
-
setColumnDefault(tableName: string, columnName: string, defaultValue: string | null): Promise<any>;
|
|
258
|
-
addForeignKey(tableName: string, fk: {
|
|
259
|
-
column: string;
|
|
260
|
-
ref_table: string;
|
|
261
|
-
ref_column: string;
|
|
262
|
-
on_delete?: string;
|
|
263
|
-
on_update?: string;
|
|
264
|
-
}): Promise<any>;
|
|
265
|
-
listForeignKeys(tableName: string): Promise<any>;
|
|
266
|
-
dropForeignKey(tableName: string, constraintName: string): Promise<any>;
|
|
267
|
-
addUniqueConstraint(tableName: string, columnName: string): Promise<any>;
|
|
268
|
-
dropConstraint(tableName: string, constraintName: string): Promise<any>;
|
|
269
|
-
raw(query: string): Promise<any>;
|
|
270
|
-
queryData(tableName: string, options: {
|
|
271
|
-
page?: number;
|
|
272
|
-
limit?: number;
|
|
273
|
-
filters?: any[];
|
|
274
|
-
}): Promise<any>;
|
|
275
|
-
downloadExport(tableName: string, format: 'sql' | 'csv' | 'backup', filters?: any[]): Promise<any>;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Storage Module - File & bucket operations (MinIO-backed)
|
|
280
|
-
*
|
|
281
|
-
* Files: upload, list, get (metadata + presigned URL), delete
|
|
282
|
-
* Buckets: create, list, get, delete, listFiles
|
|
283
|
-
*/
|
|
284
|
-
|
|
285
|
-
interface StorageFile {
|
|
286
|
-
id: string;
|
|
287
|
-
bucket_id: string;
|
|
288
|
-
name: string;
|
|
289
|
-
mime_type: string;
|
|
290
|
-
size: number;
|
|
291
|
-
created_at: string;
|
|
292
|
-
}
|
|
293
|
-
interface StorageFileWithUrl {
|
|
294
|
-
metadata: StorageFile;
|
|
295
|
-
url: string;
|
|
296
|
-
}
|
|
297
|
-
interface StorageBucket {
|
|
298
|
-
id: string;
|
|
299
|
-
name: string;
|
|
300
|
-
is_public: boolean;
|
|
301
|
-
created_at: string;
|
|
302
|
-
}
|
|
303
|
-
interface StorageModule {
|
|
304
|
-
/** Upload a file. Optionally target a specific bucket by ID. */
|
|
305
|
-
upload(file: File, bucketId?: string): Promise<StorageFile>;
|
|
306
|
-
/** List all files across buckets. */
|
|
307
|
-
listFiles(): Promise<StorageFile[]>;
|
|
308
|
-
/** Get file metadata + a 15-min presigned download URL. */
|
|
309
|
-
getFile(fileId: string): Promise<StorageFileWithUrl>;
|
|
310
|
-
/** Delete a file by ID. */
|
|
311
|
-
deleteFile(fileId: string): Promise<void>;
|
|
312
|
-
/** Create a new bucket. */
|
|
313
|
-
createBucket(name: string, isPublic?: boolean): Promise<StorageBucket>;
|
|
314
|
-
/** List all buckets. */
|
|
315
|
-
listBuckets(): Promise<StorageBucket[]>;
|
|
316
|
-
/** Get bucket info by ID. */
|
|
317
|
-
getBucket(bucketId: string): Promise<StorageBucket>;
|
|
318
|
-
/** Delete an empty bucket. */
|
|
319
|
-
deleteBucket(bucketId: string): Promise<void>;
|
|
320
|
-
/** List files inside a specific bucket. */
|
|
321
|
-
listBucketFiles(bucketId: string): Promise<StorageFile[]>;
|
|
322
|
-
/** @deprecated Use upload(file, bucketId?) instead. */
|
|
323
|
-
upload(table: string, file: File): Promise<any>;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Backups Module - Database backup operations
|
|
328
|
-
*/
|
|
329
|
-
|
|
330
|
-
interface BackupsModule {
|
|
331
|
-
create(options?: {
|
|
332
|
-
name?: string;
|
|
333
|
-
tables?: string[];
|
|
334
|
-
}): Promise<any>;
|
|
335
|
-
list(): Promise<any>;
|
|
336
|
-
get(backupId: string): Promise<any>;
|
|
337
|
-
restore(backupId: string): Promise<any>;
|
|
338
|
-
delete(backupId: string): Promise<any>;
|
|
339
|
-
getDownloadUrl(backupId: string): string;
|
|
340
|
-
listTables(): Promise<any>;
|
|
341
|
-
importFile(formData: FormData): Promise<any>;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Migrations Module - Database migration operations
|
|
346
|
-
*/
|
|
347
|
-
|
|
348
|
-
interface MigrationsModule {
|
|
349
|
-
create(input: {
|
|
350
|
-
name: string;
|
|
351
|
-
description?: string;
|
|
352
|
-
up_sql: string;
|
|
353
|
-
down_sql?: string;
|
|
354
|
-
}): Promise<any>;
|
|
355
|
-
list(): Promise<any>;
|
|
356
|
-
get(id: string): Promise<any>;
|
|
357
|
-
apply(id: string): Promise<any>;
|
|
358
|
-
rollback(id: string): Promise<any>;
|
|
359
|
-
delete(id: string): Promise<any>;
|
|
360
|
-
generate(tableName: string, changes: any[]): Promise<any>;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Functions Module - Edge function operations
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
interface FunctionsModule {
|
|
368
|
-
invoke(id: string, data?: any): Promise<any>;
|
|
369
|
-
list(): Promise<any>;
|
|
370
|
-
create(name: string, code: string): Promise<any>;
|
|
371
|
-
delete(id: string): Promise<any>;
|
|
372
|
-
update(id: string, code: string): Promise<any>;
|
|
373
|
-
listHooks(): Promise<any>;
|
|
374
|
-
createHook(data: {
|
|
375
|
-
event_type: string;
|
|
376
|
-
function_id: string;
|
|
377
|
-
table_name?: string;
|
|
378
|
-
config?: any;
|
|
379
|
-
}): Promise<any>;
|
|
380
|
-
deleteHook(id: string): Promise<any>;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* Jobs Module - Scheduled jobs (CRON) operations
|
|
385
|
-
*/
|
|
386
|
-
|
|
387
|
-
interface JobInput {
|
|
388
|
-
name: string;
|
|
389
|
-
schedule: string;
|
|
390
|
-
function_id: string;
|
|
391
|
-
description?: string;
|
|
392
|
-
payload?: Record<string, any>;
|
|
393
|
-
timezone?: string;
|
|
394
|
-
}
|
|
395
|
-
interface JobUpdateInput {
|
|
396
|
-
name?: string;
|
|
397
|
-
schedule?: string;
|
|
398
|
-
function_id?: string;
|
|
399
|
-
description?: string;
|
|
400
|
-
payload?: Record<string, any>;
|
|
401
|
-
timezone?: string;
|
|
402
|
-
enabled?: boolean;
|
|
403
|
-
}
|
|
404
|
-
interface JobsModule {
|
|
405
|
-
create(input: JobInput): Promise<any>;
|
|
406
|
-
list(): Promise<any>;
|
|
407
|
-
get(id: string): Promise<any>;
|
|
408
|
-
update(id: string, input: JobUpdateInput): Promise<any>;
|
|
409
|
-
delete(id: string): Promise<any>;
|
|
410
|
-
toggle(id: string, enabled: boolean): Promise<any>;
|
|
411
|
-
runNow(id: string): Promise<any>;
|
|
412
|
-
getExecutions(id: string, limit?: number): Promise<any>;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Environment Variables Module
|
|
417
|
-
*/
|
|
418
|
-
|
|
419
|
-
interface EnvVarsModule {
|
|
420
|
-
create(input: {
|
|
421
|
-
key: string;
|
|
422
|
-
value: string;
|
|
423
|
-
is_secret?: boolean;
|
|
424
|
-
}): Promise<any>;
|
|
425
|
-
list(): Promise<any>;
|
|
426
|
-
get(id: string): Promise<any>;
|
|
427
|
-
update(id: string, value: string): Promise<any>;
|
|
428
|
-
delete(id: string): Promise<any>;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Email Module - Email service operations
|
|
433
|
-
*/
|
|
434
|
-
|
|
435
|
-
interface EmailConfig {
|
|
436
|
-
provider: string;
|
|
437
|
-
smtp_host?: string;
|
|
438
|
-
smtp_port?: number;
|
|
439
|
-
smtp_user?: string;
|
|
440
|
-
smtp_password?: string;
|
|
441
|
-
sendgrid_api_key?: string;
|
|
442
|
-
resend_api_key?: string;
|
|
443
|
-
from_email: string;
|
|
444
|
-
from_name?: string;
|
|
445
|
-
}
|
|
446
|
-
interface EmailTemplate {
|
|
447
|
-
name: string;
|
|
448
|
-
subject: string;
|
|
449
|
-
text_body?: string;
|
|
450
|
-
html_body?: string;
|
|
451
|
-
}
|
|
452
|
-
interface SendEmailInput {
|
|
453
|
-
to: string[];
|
|
454
|
-
subject: string;
|
|
455
|
-
text_body?: string;
|
|
456
|
-
html_body?: string;
|
|
457
|
-
template_id?: string;
|
|
458
|
-
template_data?: Record<string, any>;
|
|
459
|
-
}
|
|
460
|
-
interface EmailModule {
|
|
461
|
-
send(input: SendEmailInput): Promise<any>;
|
|
462
|
-
getConfig(): Promise<any>;
|
|
463
|
-
saveConfig(config: EmailConfig): Promise<any>;
|
|
464
|
-
createTemplate(template: EmailTemplate): Promise<any>;
|
|
465
|
-
listTemplates(): Promise<any>;
|
|
466
|
-
getTemplate(id: string): Promise<any>;
|
|
467
|
-
updateTemplate(id: string, template: Partial<EmailTemplate>): Promise<any>;
|
|
468
|
-
deleteTemplate(id: string): Promise<any>;
|
|
469
|
-
getLogs(options?: {
|
|
470
|
-
limit?: number;
|
|
471
|
-
offset?: number;
|
|
472
|
-
}): Promise<any>;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
/**
|
|
476
|
-
* Search Module - Full-text search operations
|
|
477
|
-
*/
|
|
478
|
-
|
|
479
|
-
interface SearchOptions {
|
|
480
|
-
tables?: string[];
|
|
481
|
-
columns?: string[];
|
|
482
|
-
limit?: number;
|
|
483
|
-
offset?: number;
|
|
484
|
-
}
|
|
485
|
-
interface SearchModule {
|
|
486
|
-
search(query: string, options?: SearchOptions): Promise<any>;
|
|
487
|
-
createIndex(table: string, columns: string[]): Promise<any>;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* GraphQL Module
|
|
492
|
-
*/
|
|
493
|
-
|
|
494
|
-
interface GraphQLModule {
|
|
495
|
-
query(query: string, variables?: Record<string, any>): Promise<any>;
|
|
496
|
-
getPlaygroundUrl(): string;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Metrics Module - Monitoring and metrics operations
|
|
501
|
-
*/
|
|
502
|
-
|
|
503
|
-
interface RequestLogsOptions {
|
|
504
|
-
limit?: number;
|
|
505
|
-
offset?: number;
|
|
506
|
-
method?: string;
|
|
507
|
-
status?: string;
|
|
508
|
-
path?: string;
|
|
509
|
-
}
|
|
510
|
-
interface ApplicationLogsOptions {
|
|
511
|
-
limit?: number;
|
|
512
|
-
offset?: number;
|
|
513
|
-
level?: string;
|
|
514
|
-
source?: string;
|
|
515
|
-
search?: string;
|
|
516
|
-
}
|
|
517
|
-
interface TimeseriesOptions {
|
|
518
|
-
interval?: string;
|
|
519
|
-
start?: string;
|
|
520
|
-
end?: string;
|
|
521
|
-
}
|
|
522
|
-
interface MetricsModule {
|
|
523
|
-
getDashboardStats(): Promise<any>;
|
|
524
|
-
getRequestLogs(options?: RequestLogsOptions): Promise<any>;
|
|
525
|
-
getApplicationLogs(options?: ApplicationLogsOptions): Promise<any>;
|
|
526
|
-
getTimeseries(metric: string, options?: TimeseriesOptions): Promise<any>;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Audit Module - Audit log operations
|
|
531
|
-
*/
|
|
532
|
-
|
|
533
|
-
interface AuditLogsOptions {
|
|
534
|
-
limit?: number;
|
|
535
|
-
offset?: number;
|
|
536
|
-
action?: string;
|
|
537
|
-
user_id?: string;
|
|
538
|
-
method?: string;
|
|
539
|
-
path?: string;
|
|
540
|
-
status_code?: number;
|
|
541
|
-
start_date?: string;
|
|
542
|
-
end_date?: string;
|
|
543
|
-
}
|
|
544
|
-
interface AuditModule {
|
|
545
|
-
list(options?: AuditLogsOptions): Promise<any>;
|
|
546
|
-
getActions(): Promise<any>;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* Webhooks Module
|
|
551
|
-
*/
|
|
552
|
-
|
|
553
|
-
interface WebhookInput {
|
|
554
|
-
url: string;
|
|
555
|
-
event_types: string[];
|
|
556
|
-
}
|
|
557
|
-
interface WebhookUpdateInput {
|
|
558
|
-
url: string;
|
|
559
|
-
event_types: string[];
|
|
560
|
-
is_active: boolean;
|
|
561
|
-
}
|
|
562
|
-
interface WebhooksModule {
|
|
563
|
-
list(): Promise<any>;
|
|
564
|
-
get(id: string): Promise<any>;
|
|
565
|
-
create(input: WebhookInput): Promise<any>;
|
|
566
|
-
update(id: string, input: WebhookUpdateInput): Promise<any>;
|
|
567
|
-
delete(id: string): Promise<any>;
|
|
568
|
-
test(id: string): Promise<any>;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Log Drains Module
|
|
573
|
-
*/
|
|
574
|
-
|
|
575
|
-
interface LogDrainInput {
|
|
576
|
-
name: string;
|
|
577
|
-
type: string;
|
|
578
|
-
url: string;
|
|
579
|
-
token?: string;
|
|
580
|
-
headers?: Record<string, string>;
|
|
581
|
-
filters?: {
|
|
582
|
-
levels?: string[];
|
|
583
|
-
sources?: string[];
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
interface LogDrainUpdateInput {
|
|
587
|
-
name?: string;
|
|
588
|
-
url?: string;
|
|
589
|
-
token?: string;
|
|
590
|
-
headers?: Record<string, string>;
|
|
591
|
-
filters?: {
|
|
592
|
-
levels?: string[];
|
|
593
|
-
sources?: string[];
|
|
594
|
-
};
|
|
595
|
-
enabled?: boolean;
|
|
596
|
-
}
|
|
597
|
-
interface LogDrainsModule {
|
|
598
|
-
create(input: LogDrainInput): Promise<any>;
|
|
599
|
-
list(): Promise<any>;
|
|
600
|
-
get(id: string): Promise<any>;
|
|
601
|
-
update(id: string, input: LogDrainUpdateInput): Promise<any>;
|
|
602
|
-
delete(id: string): Promise<any>;
|
|
603
|
-
toggle(id: string, enabled: boolean): Promise<any>;
|
|
604
|
-
test(id: string): Promise<any>;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
/**
|
|
608
|
-
* Branches Module - Database branches operations
|
|
609
|
-
*/
|
|
610
|
-
|
|
611
|
-
interface BranchesModule {
|
|
612
|
-
create(input: {
|
|
613
|
-
name: string;
|
|
614
|
-
source_branch?: string;
|
|
615
|
-
}): Promise<any>;
|
|
616
|
-
list(): Promise<any>;
|
|
617
|
-
get(id: string): Promise<any>;
|
|
618
|
-
delete(id: string): Promise<any>;
|
|
619
|
-
merge(id: string, targetBranchId: string): Promise<any>;
|
|
620
|
-
reset(id: string): Promise<any>;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Realtime Module - WebSocket subscriptions
|
|
625
|
-
*/
|
|
626
|
-
|
|
627
|
-
interface Subscription {
|
|
628
|
-
unsubscribe: () => void;
|
|
629
|
-
}
|
|
630
|
-
interface RealtimeModule {
|
|
631
|
-
subscribe<T = any>(table: string, action: RealtimeAction, callback: RealtimeCallback<T>): Promise<Subscription>;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
/**
|
|
635
|
-
* API Keys Module
|
|
636
|
-
*/
|
|
637
|
-
|
|
638
|
-
interface ApiKeysModule {
|
|
639
|
-
create(name: string, permissions?: string[], expiresAt?: string): Promise<any>;
|
|
640
|
-
list(): Promise<any>;
|
|
641
|
-
revoke(keyId: string): Promise<any>;
|
|
642
|
-
delete(keyId: string): Promise<any>;
|
|
643
|
-
getInstanceToken(): Promise<any>;
|
|
644
|
-
regenerateInstanceToken(): Promise<any>;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
/**
|
|
648
|
-
* CORS Origins Module
|
|
649
|
-
*/
|
|
650
|
-
|
|
651
|
-
interface CorsOriginsModule {
|
|
652
|
-
list(): Promise<any>;
|
|
653
|
-
create(origin: string, description?: string): Promise<any>;
|
|
654
|
-
delete(id: string): Promise<any>;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
/**
|
|
658
|
-
* Main BaaS Client - Composes all feature modules
|
|
659
|
-
*
|
|
660
|
-
* Usage:
|
|
661
|
-
* ```ts
|
|
662
|
-
* const client = new BaasClient();
|
|
663
|
-
*
|
|
664
|
-
* // Authentication
|
|
665
|
-
* await client.auth.login('user@example.com', 'password');
|
|
666
|
-
*
|
|
667
|
-
* // Database operations
|
|
668
|
-
* const schemas = await client.database.getSchemas();
|
|
669
|
-
*
|
|
670
|
-
* // Query builder (fluent API)
|
|
671
|
-
* const users = await client.from('users').select('*').limit(10).get();
|
|
672
|
-
* ```
|
|
673
|
-
*/
|
|
674
|
-
declare class BaasClient extends HttpClient {
|
|
675
|
-
readonly auth: AuthModule;
|
|
676
|
-
readonly users: UsersModule;
|
|
677
|
-
readonly database: DatabaseModule;
|
|
678
|
-
readonly storage: StorageModule;
|
|
679
|
-
readonly backups: BackupsModule;
|
|
680
|
-
readonly migrations: MigrationsModule;
|
|
681
|
-
readonly functions: FunctionsModule;
|
|
682
|
-
readonly jobs: JobsModule;
|
|
683
|
-
readonly envVars: EnvVarsModule;
|
|
684
|
-
readonly email: EmailModule;
|
|
685
|
-
readonly searchService: SearchModule;
|
|
686
|
-
readonly graphqlService: GraphQLModule;
|
|
687
|
-
readonly metrics: MetricsModule;
|
|
688
|
-
readonly audit: AuditModule;
|
|
689
|
-
readonly webhooks: WebhooksModule;
|
|
690
|
-
readonly logDrains: LogDrainsModule;
|
|
691
|
-
readonly branches: BranchesModule;
|
|
692
|
-
readonly realtime: RealtimeModule;
|
|
693
|
-
readonly apiKeys: ApiKeysModule;
|
|
694
|
-
readonly environments: EnvironmentsModule;
|
|
695
|
-
readonly corsOrigins: CorsOriginsModule;
|
|
696
|
-
constructor(url?: string, apiKey?: string);
|
|
697
|
-
/**
|
|
698
|
-
* Create a query builder for fluent data queries
|
|
699
|
-
*/
|
|
700
|
-
from(table: string): QueryBuilder;
|
|
701
|
-
login(email: string, password: string): Promise<any>;
|
|
702
|
-
verifyMFA(mfaToken: string, code: string): Promise<any>;
|
|
703
|
-
getProfile(): Promise<any>;
|
|
704
|
-
register(email: string, password: string): Promise<any>;
|
|
705
|
-
forgotPassword(email: string): Promise<any>;
|
|
706
|
-
resetPassword(token: string, newPassword: string): Promise<any>;
|
|
707
|
-
validateResetToken(token: string): Promise<any>;
|
|
708
|
-
verifyEmail(token: string): Promise<any>;
|
|
709
|
-
requestEmailVerification(): Promise<any>;
|
|
710
|
-
getAuthProviders(): Promise<any>;
|
|
711
|
-
getAuthProvider(provider: string): Promise<any>;
|
|
712
|
-
configureAuthProvider(provider: string, clientID: string, clientSecret: string, enabled: boolean): Promise<any>;
|
|
713
|
-
listUsers(limit?: number, offset?: number): Promise<any>;
|
|
714
|
-
updateUser(id: string, updates: any): Promise<any>;
|
|
715
|
-
deleteUser(id: string): Promise<any>;
|
|
716
|
-
raw(query: string): Promise<any>;
|
|
717
|
-
getSchemas(options?: any): Promise<any>;
|
|
718
|
-
getSchema(name: string): Promise<any>;
|
|
719
|
-
createTable(tableName: string, definition: any): Promise<any>;
|
|
720
|
-
dropTable(tableName: string): Promise<any>;
|
|
721
|
-
renameTable(tableName: string, newName: string): Promise<any>;
|
|
722
|
-
addColumn(tableName: string, column: any): Promise<any>;
|
|
723
|
-
dropColumn(tableName: string, columnName: string): Promise<any>;
|
|
724
|
-
modifyColumn(tableName: string, columnName: string, changes: any): Promise<any>;
|
|
725
|
-
renameColumn(tableName: string, columnName: string, newName: string): Promise<any>;
|
|
726
|
-
setColumnDefault(tableName: string, columnName: string, defaultValue: string | null): Promise<any>;
|
|
727
|
-
addForeignKey(tableName: string, fk: any): Promise<any>;
|
|
728
|
-
listForeignKeys(tableName: string): Promise<any>;
|
|
729
|
-
dropForeignKey(tableName: string, constraintName: string): Promise<any>;
|
|
730
|
-
addUniqueConstraint(tableName: string, columnName: string): Promise<any>;
|
|
731
|
-
dropConstraint(tableName: string, constraintName: string): Promise<any>;
|
|
732
|
-
queryData(tableName: string, options: any): Promise<any>;
|
|
733
|
-
downloadExport(tableName: string, format: 'sql' | 'csv' | 'backup', filters?: any[]): Promise<any>;
|
|
734
|
-
upload(file: File, bucketId?: string): Promise<StorageFile>;
|
|
735
|
-
listStorageFiles(): Promise<StorageFile[]>;
|
|
736
|
-
getStorageFile(fileId: string): Promise<StorageFileWithUrl>;
|
|
737
|
-
deleteStorageFile(fileId: string): Promise<void>;
|
|
738
|
-
createStorageBucket(name: string, isPublic?: boolean): Promise<StorageBucket>;
|
|
739
|
-
listStorageBuckets(): Promise<StorageBucket[]>;
|
|
740
|
-
getStorageBucket(bucketId: string): Promise<StorageBucket>;
|
|
741
|
-
deleteStorageBucket(bucketId: string): Promise<void>;
|
|
742
|
-
listStorageBucketFiles(bucketId: string): Promise<StorageFile[]>;
|
|
743
|
-
invokeFunction(id: string, data?: any): Promise<any>;
|
|
744
|
-
createApiKey(name: string, permissions?: string[], expiresAt?: string): Promise<any>;
|
|
745
|
-
listApiKeys(): Promise<any>;
|
|
746
|
-
revokeApiKey(keyId: string): Promise<any>;
|
|
747
|
-
deleteApiKey(keyId: string): Promise<any>;
|
|
748
|
-
getInstanceToken(): Promise<any>;
|
|
749
|
-
regenerateInstanceToken(): Promise<any>;
|
|
750
|
-
createBackup(options?: any): Promise<any>;
|
|
751
|
-
listBackups(): Promise<any>;
|
|
752
|
-
getBackup(backupId: string): Promise<any>;
|
|
753
|
-
restoreBackup(backupId: string): Promise<any>;
|
|
754
|
-
deleteBackup(backupId: string): Promise<any>;
|
|
755
|
-
getBackupDownloadUrl(backupId: string): string;
|
|
756
|
-
listBackupTables(): Promise<any>;
|
|
757
|
-
importFile(formData: FormData): Promise<any>;
|
|
758
|
-
search(query: string, options?: any): Promise<any>;
|
|
759
|
-
createSearchIndex(table: string, columns: string[]): Promise<any>;
|
|
760
|
-
graphql(query: string, variables?: Record<string, any>): Promise<any>;
|
|
761
|
-
getGraphQLPlaygroundUrl(): string;
|
|
762
|
-
createMigration(input: any): Promise<any>;
|
|
763
|
-
listMigrations(): Promise<any>;
|
|
764
|
-
getMigration(id: string): Promise<any>;
|
|
765
|
-
applyMigration(id: string): Promise<any>;
|
|
766
|
-
rollbackMigration(id: string): Promise<any>;
|
|
767
|
-
deleteMigration(id: string): Promise<any>;
|
|
768
|
-
generateMigration(tableName: string, changes: any[]): Promise<any>;
|
|
769
|
-
sendEmail(input: any): Promise<any>;
|
|
770
|
-
getEmailConfig(): Promise<any>;
|
|
771
|
-
saveEmailConfig(config: any): Promise<any>;
|
|
772
|
-
createEmailTemplate(template: any): Promise<any>;
|
|
773
|
-
listEmailTemplates(): Promise<any>;
|
|
774
|
-
getEmailTemplate(id: string): Promise<any>;
|
|
775
|
-
updateEmailTemplate(id: string, template: any): Promise<any>;
|
|
776
|
-
deleteEmailTemplate(id: string): Promise<any>;
|
|
777
|
-
getEmailLogs(options?: any): Promise<any>;
|
|
778
|
-
getDashboardStats(): Promise<any>;
|
|
779
|
-
getRequestLogs(options?: any): Promise<any>;
|
|
780
|
-
getApplicationLogs(options?: any): Promise<any>;
|
|
781
|
-
getMetricTimeseries(metric: string, options?: any): Promise<any>;
|
|
782
|
-
createJob(input: any): Promise<any>;
|
|
783
|
-
listJobs(): Promise<any>;
|
|
784
|
-
getJob(id: string): Promise<any>;
|
|
785
|
-
updateJob(id: string, input: any): Promise<any>;
|
|
786
|
-
deleteJob(id: string): Promise<any>;
|
|
787
|
-
toggleJob(id: string, enabled: boolean): Promise<any>;
|
|
788
|
-
runJobNow(id: string): Promise<any>;
|
|
789
|
-
getJobExecutions(id: string, limit?: number): Promise<any>;
|
|
790
|
-
createEnvVar(input: any): Promise<any>;
|
|
791
|
-
listEnvVars(): Promise<any>;
|
|
792
|
-
getEnvVar(id: string): Promise<any>;
|
|
793
|
-
updateEnvVar(id: string, value: string): Promise<any>;
|
|
794
|
-
deleteEnvVar(id: string): Promise<any>;
|
|
795
|
-
createBranch(input: any): Promise<any>;
|
|
796
|
-
listBranches(): Promise<any>;
|
|
797
|
-
getBranch(id: string): Promise<any>;
|
|
798
|
-
deleteBranch(id: string): Promise<any>;
|
|
799
|
-
mergeBranch(id: string, targetBranchId: string): Promise<any>;
|
|
800
|
-
resetBranch(id: string): Promise<any>;
|
|
801
|
-
createLogDrain(input: any): Promise<any>;
|
|
802
|
-
listLogDrains(): Promise<any>;
|
|
803
|
-
getLogDrain(id: string): Promise<any>;
|
|
804
|
-
updateLogDrain(id: string, input: any): Promise<any>;
|
|
805
|
-
deleteLogDrain(id: string): Promise<any>;
|
|
806
|
-
toggleLogDrain(id: string, enabled: boolean): Promise<any>;
|
|
807
|
-
testLogDrain(id: string): Promise<any>;
|
|
808
|
-
listWebhooks(): Promise<any>;
|
|
809
|
-
getWebhook(id: string): Promise<any>;
|
|
810
|
-
createWebhook(input: any): Promise<any>;
|
|
811
|
-
updateWebhook(id: string, input: any): Promise<any>;
|
|
812
|
-
deleteWebhook(id: string): Promise<any>;
|
|
813
|
-
testWebhook(id: string): Promise<any>;
|
|
814
|
-
listAuditLogs(options?: any): Promise<any>;
|
|
815
|
-
getAuditActions(): Promise<any>;
|
|
816
|
-
subscribe<T = any>(table: string, action: RealtimeAction, callback: RealtimeCallback<T>): Promise<Subscription>;
|
|
817
|
-
getEnvironmentStatus(): Promise<EnvironmentStatus>;
|
|
818
|
-
initTestEnvironment(): Promise<any>;
|
|
819
|
-
promoteTestToProd(): Promise<PromoteResult>;
|
|
820
|
-
revertTestEnvironment(): Promise<any>;
|
|
821
|
-
listCorsOrigins(): Promise<any>;
|
|
822
|
-
addCorsOrigin(origin: string, description?: string): Promise<any>;
|
|
823
|
-
deleteCorsOrigin(id: string): Promise<any>;
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
export { type ApiKeysModule, type ApiResponse, type ApplicationLogsOptions, type AuditLogsOptions, type AuditModule, type AuthModule, BaasClient, type BackupsModule, type BranchesModule, type CorsOriginsModule, type DatabaseModule, type EmailConfig, type EmailModule, type EmailTemplate, type EnvVarsModule, type FunctionsModule, type GraphQLModule, HttpClient, type HttpMethod, type JobInput, type JobUpdateInput, type JobsModule, type LogDrainInput, type LogDrainUpdateInput, type LogDrainsModule, type MetricsModule, type MigrationsModule, type PaginationOptions, QueryBuilder, type QueryFilter, type RealtimeModule, type RequestLogsOptions, type RequestOptions, type SearchModule, type SearchOptions, type SendEmailInput, type StorageBucket, type StorageFile, type StorageFileWithUrl, type StorageModule, type Subscription, type TimeseriesOptions, type UsersModule, type WebhookInput, type WebhookUpdateInput, type WebhooksModule };
|