@giaeulate/baas-sdk 1.1.1 → 1.3.0
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/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/cli.js +416 -0
- package/dist/index.cjs +1985 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1037 -0
- package/dist/index.d.ts +1037 -0
- package/dist/index.js +1956 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -37
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1037 @@
|
|
|
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
|
+
/** Privilege class of the API key. anon = RLS applies (safe for browsers);
|
|
49
|
+
* service_role = RLS bypass / admin (server-side only). Both share the
|
|
50
|
+
* `baas_sk_` prefix, so the type cannot be inferred — it must be declared. */
|
|
51
|
+
type KeyType = 'anon' | 'service_role';
|
|
52
|
+
interface ClientOptions {
|
|
53
|
+
/** Defaults to 'service_role' for backward-compat. Set 'anon' in any client
|
|
54
|
+
* bundle (browser / mobile app) — see warnIfUnsafeKey. */
|
|
55
|
+
keyType?: KeyType;
|
|
56
|
+
}
|
|
57
|
+
declare class HttpClient {
|
|
58
|
+
url: string;
|
|
59
|
+
apiKey: string;
|
|
60
|
+
keyType: KeyType;
|
|
61
|
+
token: string | null;
|
|
62
|
+
private environment;
|
|
63
|
+
private _onForceLogout;
|
|
64
|
+
constructor(url?: string, apiKey?: string, options?: ClientOptions);
|
|
65
|
+
/** SECURITY: a service_role key bypasses RLS and grants admin over every
|
|
66
|
+
* tenant. If it ends up in a browser bundle, anyone can extract it. Warn
|
|
67
|
+
* loudly when a non-anon key is constructed in a browser context. */
|
|
68
|
+
private warnIfUnsafeKey;
|
|
69
|
+
/**
|
|
70
|
+
* Set the auth token manually (e.g. restoring from SecureStore in React Native).
|
|
71
|
+
* Persists to both the in-memory property and localStorage so getDynamicToken() works.
|
|
72
|
+
*/
|
|
73
|
+
setToken(token: string | null): void;
|
|
74
|
+
/**
|
|
75
|
+
* Register a callback invoked on forced logout (401).
|
|
76
|
+
* Use this in React Native instead of the default window.location redirect.
|
|
77
|
+
*/
|
|
78
|
+
onForceLogout(callback: () => void): void;
|
|
79
|
+
protected cleanValue(val: string | null): string | null;
|
|
80
|
+
/**
|
|
81
|
+
* Public header generator for adapters
|
|
82
|
+
*/
|
|
83
|
+
getHeaders(contentType?: string): Record<string, string>;
|
|
84
|
+
getDynamicToken(): string | null;
|
|
85
|
+
/**
|
|
86
|
+
* Core HTTP request method - DRY principle
|
|
87
|
+
*/
|
|
88
|
+
protected request<T = any>(endpoint: string, options?: RequestOptions): Promise<T>;
|
|
89
|
+
protected get<T = any>(endpoint: string): Promise<T>;
|
|
90
|
+
protected post<T = any>(endpoint: string, body?: unknown): Promise<T>;
|
|
91
|
+
protected put<T = any>(endpoint: string, body?: unknown): Promise<T>;
|
|
92
|
+
protected patch<T = any>(endpoint: string, body?: unknown): Promise<T>;
|
|
93
|
+
protected delete<T = any>(endpoint: string): Promise<T>;
|
|
94
|
+
private getCSRFToken;
|
|
95
|
+
setEnvironment(env: string): void;
|
|
96
|
+
getEnvironment(): string;
|
|
97
|
+
logout(): void;
|
|
98
|
+
forceLogout(): void;
|
|
99
|
+
handleIPBlocked(ip?: string): void;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Environments Module - Test/Prod environment management
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
interface EnvironmentStatus {
|
|
107
|
+
test_exists: boolean;
|
|
108
|
+
test_status?: string;
|
|
109
|
+
test_created_at?: string;
|
|
110
|
+
test_schema_name?: string;
|
|
111
|
+
prod_schema_name: string;
|
|
112
|
+
table_count: number;
|
|
113
|
+
}
|
|
114
|
+
interface PromoteResult {
|
|
115
|
+
tables_promoted: number;
|
|
116
|
+
status: string;
|
|
117
|
+
}
|
|
118
|
+
interface EnvironmentsModule {
|
|
119
|
+
status(): Promise<EnvironmentStatus>;
|
|
120
|
+
init(): Promise<any>;
|
|
121
|
+
promote(): Promise<PromoteResult>;
|
|
122
|
+
revert(): Promise<any>;
|
|
123
|
+
setActive(env: 'test' | 'prod'): void;
|
|
124
|
+
getActive(): string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* QueryBuilder - Fluent API for data queries
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
declare class QueryBuilder {
|
|
132
|
+
private table;
|
|
133
|
+
private url;
|
|
134
|
+
private client;
|
|
135
|
+
private queryParams;
|
|
136
|
+
private filters;
|
|
137
|
+
constructor(table: string, url: string, client: HttpClient);
|
|
138
|
+
select(columns?: string): this;
|
|
139
|
+
eq(column: string, value: any): this;
|
|
140
|
+
neq(column: string, value: any): this;
|
|
141
|
+
gt(column: string, value: any): this;
|
|
142
|
+
gte(column: string, value: any): this;
|
|
143
|
+
lt(column: string, value: any): this;
|
|
144
|
+
lte(column: string, value: any): this;
|
|
145
|
+
like(column: string, value: any): this;
|
|
146
|
+
ilike(column: string, value: any): this;
|
|
147
|
+
is(column: string, value: any): this;
|
|
148
|
+
in(column: string, values: any[]): this;
|
|
149
|
+
not(column: string, operator: string, value: any): this;
|
|
150
|
+
/** Array/jsonb/range contains (@>). Arrays become a `{a,b}` literal. */
|
|
151
|
+
contains(column: string, values: any): this;
|
|
152
|
+
/** Array/jsonb/range contained-by (<@). */
|
|
153
|
+
containedBy(column: string, values: any): this;
|
|
154
|
+
/** Array/range overlap (&&). */
|
|
155
|
+
overlaps(column: string, values: any): this;
|
|
156
|
+
/** Full-text search (@@). type: fts|plfts|phfts|wfts (tsquery flavour). */
|
|
157
|
+
textSearch(column: string, query: string, type?: 'fts' | 'plfts' | 'phfts' | 'wfts'): this;
|
|
158
|
+
private arrayLiteral;
|
|
159
|
+
/** OR group: `or=(c1,c2)`. Members are dotted `col.op.value` strings. */
|
|
160
|
+
or(filters: string): this;
|
|
161
|
+
/** AND group: `and=(c1,c2)` — e.g. a range `qty.gt.5,qty.lt.20`. */
|
|
162
|
+
and(filters: string): this;
|
|
163
|
+
/** Negated AND group: `not.and=(...)`. */
|
|
164
|
+
notAnd(filters: string): this;
|
|
165
|
+
/** Negated OR group: `not.or=(...)`. */
|
|
166
|
+
notOr(filters: string): this;
|
|
167
|
+
order(column: string, { ascending }?: {
|
|
168
|
+
ascending?: boolean | undefined;
|
|
169
|
+
}): this;
|
|
170
|
+
limit(count: number): this;
|
|
171
|
+
offset(count: number): this;
|
|
172
|
+
get(): Promise<{
|
|
173
|
+
data: null;
|
|
174
|
+
error: any;
|
|
175
|
+
status: number;
|
|
176
|
+
} | {
|
|
177
|
+
data: any;
|
|
178
|
+
error: null;
|
|
179
|
+
status: number;
|
|
180
|
+
}>;
|
|
181
|
+
insert(data: any): Promise<{
|
|
182
|
+
data: null;
|
|
183
|
+
error: any;
|
|
184
|
+
status: number;
|
|
185
|
+
} | {
|
|
186
|
+
data: any;
|
|
187
|
+
error: null;
|
|
188
|
+
status: number;
|
|
189
|
+
}>;
|
|
190
|
+
update(id: string | number, data: any): Promise<{
|
|
191
|
+
data: null;
|
|
192
|
+
error: any;
|
|
193
|
+
status: number;
|
|
194
|
+
} | {
|
|
195
|
+
data: any;
|
|
196
|
+
error: null;
|
|
197
|
+
status: number;
|
|
198
|
+
}>;
|
|
199
|
+
delete(id: string | number): Promise<{
|
|
200
|
+
data: null;
|
|
201
|
+
error: any;
|
|
202
|
+
status: number;
|
|
203
|
+
} | {
|
|
204
|
+
data: any;
|
|
205
|
+
error: null;
|
|
206
|
+
status: number;
|
|
207
|
+
} | {
|
|
208
|
+
success: boolean;
|
|
209
|
+
}>;
|
|
210
|
+
/** Insert-or-update on conflict. [onConflict] is the conflict-target column(s). */
|
|
211
|
+
upsert(data: any, onConflict: string): Promise<{
|
|
212
|
+
data: null;
|
|
213
|
+
error: any;
|
|
214
|
+
status: number;
|
|
215
|
+
} | {
|
|
216
|
+
data: any;
|
|
217
|
+
error: null;
|
|
218
|
+
status: number;
|
|
219
|
+
}>;
|
|
220
|
+
/**
|
|
221
|
+
* Count rows matching the current filters (PostgREST parity). Sends
|
|
222
|
+
* `Prefer: count=exact` and parses the total from the `Content-Range`
|
|
223
|
+
* response header. Returns `{ count, error, status }`.
|
|
224
|
+
*/
|
|
225
|
+
count(): Promise<{
|
|
226
|
+
count: number;
|
|
227
|
+
error: string | null;
|
|
228
|
+
status: number;
|
|
229
|
+
}>;
|
|
230
|
+
private getHeaders;
|
|
231
|
+
private handleResponse;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Auth Module - Authentication operations
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
interface MFASetupResponse {
|
|
239
|
+
secret: string;
|
|
240
|
+
qr_code_url: string;
|
|
241
|
+
recovery_codes: string[];
|
|
242
|
+
}
|
|
243
|
+
interface AuthModule {
|
|
244
|
+
login(email: string, password: string): Promise<any>;
|
|
245
|
+
logout(): Promise<void>;
|
|
246
|
+
verifyMFA(mfaToken: string, code: string): Promise<any>;
|
|
247
|
+
verifyMFAWithRecoveryCode(mfaToken: string, recoveryCode: string): Promise<any>;
|
|
248
|
+
setupMFA(): Promise<MFASetupResponse>;
|
|
249
|
+
enableMFA(secret: string, code: string, recoveryCodes?: string[]): Promise<any>;
|
|
250
|
+
disableMFA(code: string): Promise<any>;
|
|
251
|
+
getProfile(): Promise<any>;
|
|
252
|
+
register(email: string, password: string): Promise<any>;
|
|
253
|
+
forgotPassword(email: string): Promise<any>;
|
|
254
|
+
resetPassword(token: string, newPassword: string): Promise<any>;
|
|
255
|
+
validateResetToken(token: string): Promise<any>;
|
|
256
|
+
verifyEmail(token: string): Promise<any>;
|
|
257
|
+
requestEmailVerification(): Promise<any>;
|
|
258
|
+
signInAnonymous(): Promise<any>;
|
|
259
|
+
requestOtp(email: string, createUser?: boolean): Promise<any>;
|
|
260
|
+
verifyOtp(type: 'email_otp' | 'magic_link', email: string, token: string): Promise<any>;
|
|
261
|
+
upgradeAnonymous(email: string, password: string): Promise<any>;
|
|
262
|
+
getAuthProviders(): Promise<any>;
|
|
263
|
+
getAuthProvider(provider: string): Promise<any>;
|
|
264
|
+
configureAuthProvider(provider: string, clientID: string, clientSecret: string, enabled: boolean): Promise<any>;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Users Module - User management operations
|
|
269
|
+
*/
|
|
270
|
+
|
|
271
|
+
interface UsersModule {
|
|
272
|
+
list(limit?: number, offset?: number): Promise<any>;
|
|
273
|
+
update(id: string, updates: {
|
|
274
|
+
email?: string;
|
|
275
|
+
role?: string;
|
|
276
|
+
email_verified?: boolean;
|
|
277
|
+
}): Promise<any>;
|
|
278
|
+
delete(id: string): Promise<any>;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Database Module - Schema, table, and column operations
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
interface DatabaseModule {
|
|
286
|
+
getSchemas(options?: {
|
|
287
|
+
search?: string;
|
|
288
|
+
limit?: number;
|
|
289
|
+
offset?: number;
|
|
290
|
+
}): Promise<any>;
|
|
291
|
+
getSchema(name: string): Promise<any>;
|
|
292
|
+
saveSchemas(data: {
|
|
293
|
+
table_name: string;
|
|
294
|
+
definition: any;
|
|
295
|
+
}): Promise<any>;
|
|
296
|
+
createTable(tableName: string, definition: Record<string, string | {
|
|
297
|
+
type: string;
|
|
298
|
+
nullable?: boolean;
|
|
299
|
+
unique?: boolean;
|
|
300
|
+
default?: string;
|
|
301
|
+
}>): Promise<any>;
|
|
302
|
+
dropTable(tableName: string): Promise<any>;
|
|
303
|
+
renameTable(tableName: string, newName: string): Promise<any>;
|
|
304
|
+
addColumn(tableName: string, column: {
|
|
305
|
+
name: string;
|
|
306
|
+
type: string;
|
|
307
|
+
nullable?: boolean;
|
|
308
|
+
default_value?: string;
|
|
309
|
+
}): Promise<any>;
|
|
310
|
+
dropColumn(tableName: string, columnName: string): Promise<any>;
|
|
311
|
+
modifyColumn(tableName: string, columnName: string, changes: {
|
|
312
|
+
type: string;
|
|
313
|
+
nullable?: boolean;
|
|
314
|
+
}): Promise<any>;
|
|
315
|
+
renameColumn(tableName: string, columnName: string, newName: string): Promise<any>;
|
|
316
|
+
setColumnDefault(tableName: string, columnName: string, defaultValue: string | null): Promise<any>;
|
|
317
|
+
addForeignKey(tableName: string, fk: {
|
|
318
|
+
column: string;
|
|
319
|
+
ref_table: string;
|
|
320
|
+
ref_column: string;
|
|
321
|
+
on_delete?: string;
|
|
322
|
+
on_update?: string;
|
|
323
|
+
}): Promise<any>;
|
|
324
|
+
listForeignKeys(tableName: string): Promise<any>;
|
|
325
|
+
dropForeignKey(tableName: string, constraintName: string): Promise<any>;
|
|
326
|
+
addUniqueConstraint(tableName: string, columnName: string): Promise<any>;
|
|
327
|
+
dropConstraint(tableName: string, constraintName: string): Promise<any>;
|
|
328
|
+
raw(query: string): Promise<any>;
|
|
329
|
+
queryData(tableName: string, options: {
|
|
330
|
+
page?: number;
|
|
331
|
+
limit?: number;
|
|
332
|
+
filters?: any[];
|
|
333
|
+
}): Promise<any>;
|
|
334
|
+
downloadExport(tableName: string, format: 'sql' | 'csv' | 'backup', filters?: any[]): Promise<any>;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Storage Module - File & bucket operations (MinIO-backed)
|
|
339
|
+
*
|
|
340
|
+
* Files: upload, list, get (metadata + presigned URL), delete
|
|
341
|
+
* Buckets: create, list, get, delete, listFiles
|
|
342
|
+
*/
|
|
343
|
+
|
|
344
|
+
interface StorageFile {
|
|
345
|
+
id: string;
|
|
346
|
+
bucket_id: string;
|
|
347
|
+
name: string;
|
|
348
|
+
mime_type: string;
|
|
349
|
+
size: number;
|
|
350
|
+
created_at: string;
|
|
351
|
+
}
|
|
352
|
+
interface StorageFileWithUrl {
|
|
353
|
+
metadata: StorageFile;
|
|
354
|
+
url: string;
|
|
355
|
+
}
|
|
356
|
+
interface StorageBucket {
|
|
357
|
+
id: string;
|
|
358
|
+
name: string;
|
|
359
|
+
is_public: boolean;
|
|
360
|
+
created_at: string;
|
|
361
|
+
}
|
|
362
|
+
interface StorageModule {
|
|
363
|
+
/** Upload a file. Optionally target a specific bucket by ID. */
|
|
364
|
+
upload(file: File, bucketId?: string): Promise<StorageFile>;
|
|
365
|
+
/** List all files across buckets. */
|
|
366
|
+
listFiles(): Promise<StorageFile[]>;
|
|
367
|
+
/** Get file metadata + a presigned download URL. expiresIn (seconds) controls
|
|
368
|
+
* the URL lifetime (default 15m, server cap 7d). */
|
|
369
|
+
getFile(fileId: string, expiresIn?: number): Promise<StorageFileWithUrl>;
|
|
370
|
+
/** Create a time-limited signed download URL (Supabase createSignedUrl parity). */
|
|
371
|
+
createSignedUrl(fileId: string, expiresIn?: number): Promise<{
|
|
372
|
+
signedUrl: string;
|
|
373
|
+
}>;
|
|
374
|
+
/** Delete a file by ID. */
|
|
375
|
+
deleteFile(fileId: string): Promise<void>;
|
|
376
|
+
/** Create a new bucket. */
|
|
377
|
+
createBucket(name: string, isPublic?: boolean): Promise<StorageBucket>;
|
|
378
|
+
/** Update mutable bucket fields (is_public). */
|
|
379
|
+
updateBucket(bucketId: string, opts: {
|
|
380
|
+
isPublic?: boolean;
|
|
381
|
+
}): Promise<StorageBucket>;
|
|
382
|
+
/** List all buckets. */
|
|
383
|
+
listBuckets(): Promise<StorageBucket[]>;
|
|
384
|
+
/** Get bucket info by ID. */
|
|
385
|
+
getBucket(bucketId: string): Promise<StorageBucket>;
|
|
386
|
+
/** Delete an empty bucket. */
|
|
387
|
+
deleteBucket(bucketId: string): Promise<void>;
|
|
388
|
+
/** List files inside a specific bucket. */
|
|
389
|
+
listBucketFiles(bucketId: string): Promise<StorageFile[]>;
|
|
390
|
+
/** Download a file's bytes via the backend download route (streams + enforces
|
|
391
|
+
* the bucket's public/RLS rules; the Bearer is sent so private files work).
|
|
392
|
+
* Returns a Blob. */
|
|
393
|
+
download(fileId: string): Promise<Blob>;
|
|
394
|
+
/** @deprecated Use upload(file, bucketId?) instead. */
|
|
395
|
+
upload(table: string, file: File): Promise<any>;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Backups Module - Database backup operations
|
|
400
|
+
*/
|
|
401
|
+
|
|
402
|
+
interface BackupsModule {
|
|
403
|
+
create(options?: {
|
|
404
|
+
name?: string;
|
|
405
|
+
tables?: string[];
|
|
406
|
+
}): Promise<any>;
|
|
407
|
+
list(): Promise<any>;
|
|
408
|
+
get(backupId: string): Promise<any>;
|
|
409
|
+
restore(backupId: string): Promise<any>;
|
|
410
|
+
delete(backupId: string): Promise<any>;
|
|
411
|
+
getDownloadUrl(backupId: string): string;
|
|
412
|
+
listTables(): Promise<any>;
|
|
413
|
+
importFile(formData: FormData): Promise<any>;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Migrations Module - Database migration operations
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
interface MigrationsModule {
|
|
421
|
+
create(input: {
|
|
422
|
+
name: string;
|
|
423
|
+
description?: string;
|
|
424
|
+
up_sql: string;
|
|
425
|
+
down_sql?: string;
|
|
426
|
+
}): Promise<any>;
|
|
427
|
+
list(): Promise<any>;
|
|
428
|
+
get(id: string): Promise<any>;
|
|
429
|
+
apply(id: string): Promise<any>;
|
|
430
|
+
rollback(id: string): Promise<any>;
|
|
431
|
+
delete(id: string): Promise<any>;
|
|
432
|
+
generate(tableName: string, changes: any[]): Promise<any>;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Functions Module - Edge function operations
|
|
437
|
+
*/
|
|
438
|
+
|
|
439
|
+
interface FunctionsModule {
|
|
440
|
+
invoke(id: string, data?: any): Promise<any>;
|
|
441
|
+
get(id: string): Promise<any>;
|
|
442
|
+
list(): Promise<any>;
|
|
443
|
+
create(name: string, code: string, options?: {
|
|
444
|
+
runtime?: 'wazero' | 'deno';
|
|
445
|
+
timeout_ms?: number;
|
|
446
|
+
}): Promise<any>;
|
|
447
|
+
delete(id: string): Promise<any>;
|
|
448
|
+
update(id: string, code: string, options?: {
|
|
449
|
+
runtime?: 'wazero' | 'deno';
|
|
450
|
+
timeout_ms?: number;
|
|
451
|
+
}): Promise<any>;
|
|
452
|
+
executeCode(code: string, options?: {
|
|
453
|
+
data?: any;
|
|
454
|
+
runtime?: 'wazero' | 'deno';
|
|
455
|
+
timeout_ms?: number;
|
|
456
|
+
}): Promise<any>;
|
|
457
|
+
listHooks(): Promise<any>;
|
|
458
|
+
createHook(data: {
|
|
459
|
+
event_type: string;
|
|
460
|
+
function_id: string;
|
|
461
|
+
table_name?: string;
|
|
462
|
+
config?: any;
|
|
463
|
+
}): Promise<any>;
|
|
464
|
+
deleteHook(id: string): Promise<any>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Jobs Module - Scheduled jobs (CRON) operations
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
interface JobInput {
|
|
472
|
+
name: string;
|
|
473
|
+
schedule: string;
|
|
474
|
+
function_id: string;
|
|
475
|
+
description?: string;
|
|
476
|
+
payload?: Record<string, any>;
|
|
477
|
+
timezone?: string;
|
|
478
|
+
}
|
|
479
|
+
interface JobUpdateInput {
|
|
480
|
+
name?: string;
|
|
481
|
+
schedule?: string;
|
|
482
|
+
function_id?: string;
|
|
483
|
+
description?: string;
|
|
484
|
+
payload?: Record<string, any>;
|
|
485
|
+
timezone?: string;
|
|
486
|
+
enabled?: boolean;
|
|
487
|
+
}
|
|
488
|
+
interface JobsModule {
|
|
489
|
+
create(input: JobInput): Promise<any>;
|
|
490
|
+
list(): Promise<any>;
|
|
491
|
+
get(id: string): Promise<any>;
|
|
492
|
+
update(id: string, input: JobUpdateInput): Promise<any>;
|
|
493
|
+
delete(id: string): Promise<any>;
|
|
494
|
+
toggle(id: string, enabled: boolean): Promise<any>;
|
|
495
|
+
runNow(id: string): Promise<any>;
|
|
496
|
+
getExecutions(id: string, limit?: number): Promise<any>;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Environment Variables Module
|
|
501
|
+
*/
|
|
502
|
+
|
|
503
|
+
interface EnvVarsModule {
|
|
504
|
+
create(input: {
|
|
505
|
+
key: string;
|
|
506
|
+
value: string;
|
|
507
|
+
is_secret?: boolean;
|
|
508
|
+
}): Promise<any>;
|
|
509
|
+
list(): Promise<any>;
|
|
510
|
+
get(id: string): Promise<any>;
|
|
511
|
+
update(id: string, value: string): Promise<any>;
|
|
512
|
+
delete(id: string): Promise<any>;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Email Module - Email service operations
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
interface EmailConfig {
|
|
520
|
+
provider: string;
|
|
521
|
+
smtp_host?: string;
|
|
522
|
+
smtp_port?: number;
|
|
523
|
+
smtp_user?: string;
|
|
524
|
+
smtp_password?: string;
|
|
525
|
+
sendgrid_api_key?: string;
|
|
526
|
+
resend_api_key?: string;
|
|
527
|
+
from_email: string;
|
|
528
|
+
from_name?: string;
|
|
529
|
+
}
|
|
530
|
+
interface EmailTemplate {
|
|
531
|
+
name: string;
|
|
532
|
+
subject: string;
|
|
533
|
+
text_body?: string;
|
|
534
|
+
html_body?: string;
|
|
535
|
+
}
|
|
536
|
+
interface SendEmailInput {
|
|
537
|
+
to: string[];
|
|
538
|
+
subject: string;
|
|
539
|
+
text_body?: string;
|
|
540
|
+
html_body?: string;
|
|
541
|
+
template_id?: string;
|
|
542
|
+
template_data?: Record<string, any>;
|
|
543
|
+
}
|
|
544
|
+
interface EmailModule {
|
|
545
|
+
send(input: SendEmailInput): Promise<any>;
|
|
546
|
+
getConfig(): Promise<any>;
|
|
547
|
+
saveConfig(config: EmailConfig): Promise<any>;
|
|
548
|
+
createTemplate(template: EmailTemplate): Promise<any>;
|
|
549
|
+
listTemplates(): Promise<any>;
|
|
550
|
+
getTemplate(id: string): Promise<any>;
|
|
551
|
+
updateTemplate(id: string, template: Partial<EmailTemplate>): Promise<any>;
|
|
552
|
+
deleteTemplate(id: string): Promise<any>;
|
|
553
|
+
getLogs(options?: {
|
|
554
|
+
limit?: number;
|
|
555
|
+
offset?: number;
|
|
556
|
+
}): Promise<any>;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Search Module - Full-text search operations
|
|
561
|
+
*/
|
|
562
|
+
|
|
563
|
+
interface SearchOptions {
|
|
564
|
+
tables?: string[];
|
|
565
|
+
columns?: string[];
|
|
566
|
+
limit?: number;
|
|
567
|
+
offset?: number;
|
|
568
|
+
}
|
|
569
|
+
interface SearchModule {
|
|
570
|
+
search(query: string, options?: SearchOptions): Promise<any>;
|
|
571
|
+
createIndex(table: string, columns: string[]): Promise<any>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* GraphQL Module
|
|
576
|
+
*/
|
|
577
|
+
|
|
578
|
+
interface GraphQLModule {
|
|
579
|
+
query(query: string, variables?: Record<string, any>): Promise<any>;
|
|
580
|
+
getSchema(): Promise<any>;
|
|
581
|
+
getPlaygroundUrl(): string;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Metrics Module - Monitoring and metrics operations
|
|
586
|
+
*/
|
|
587
|
+
|
|
588
|
+
interface RequestLogsOptions {
|
|
589
|
+
limit?: number;
|
|
590
|
+
offset?: number;
|
|
591
|
+
method?: string;
|
|
592
|
+
status?: string;
|
|
593
|
+
path?: string;
|
|
594
|
+
}
|
|
595
|
+
interface ApplicationLogsOptions {
|
|
596
|
+
limit?: number;
|
|
597
|
+
offset?: number;
|
|
598
|
+
level?: string;
|
|
599
|
+
source?: string;
|
|
600
|
+
search?: string;
|
|
601
|
+
}
|
|
602
|
+
interface TimeseriesOptions {
|
|
603
|
+
interval?: string;
|
|
604
|
+
start?: string;
|
|
605
|
+
end?: string;
|
|
606
|
+
}
|
|
607
|
+
interface MetricsModule {
|
|
608
|
+
getDashboardStats(): Promise<any>;
|
|
609
|
+
getRequestLogs(options?: RequestLogsOptions): Promise<any>;
|
|
610
|
+
getApplicationLogs(options?: ApplicationLogsOptions): Promise<any>;
|
|
611
|
+
getTimeseries(metric: string, options?: TimeseriesOptions): Promise<any>;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Audit Module - Audit log operations
|
|
616
|
+
*/
|
|
617
|
+
|
|
618
|
+
interface AuditLogsOptions {
|
|
619
|
+
limit?: number;
|
|
620
|
+
offset?: number;
|
|
621
|
+
action?: string;
|
|
622
|
+
user_id?: string;
|
|
623
|
+
method?: string;
|
|
624
|
+
path?: string;
|
|
625
|
+
status_code?: number;
|
|
626
|
+
start_date?: string;
|
|
627
|
+
end_date?: string;
|
|
628
|
+
}
|
|
629
|
+
interface AuditModule {
|
|
630
|
+
list(options?: AuditLogsOptions): Promise<any>;
|
|
631
|
+
getActions(): Promise<any>;
|
|
632
|
+
exportLogs(format: 'csv' | 'json', options?: AuditLogsOptions): Promise<any>;
|
|
633
|
+
purgePreview(olderThanDays: number): Promise<any>;
|
|
634
|
+
purge(olderThanDays: number): Promise<any>;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Webhooks Module
|
|
639
|
+
*/
|
|
640
|
+
|
|
641
|
+
interface WebhookInput {
|
|
642
|
+
url: string;
|
|
643
|
+
event_types: string[];
|
|
644
|
+
}
|
|
645
|
+
interface WebhookUpdateInput {
|
|
646
|
+
url: string;
|
|
647
|
+
event_types: string[];
|
|
648
|
+
is_active: boolean;
|
|
649
|
+
}
|
|
650
|
+
interface WebhooksModule {
|
|
651
|
+
list(): Promise<any>;
|
|
652
|
+
get(id: string): Promise<any>;
|
|
653
|
+
create(input: WebhookInput): Promise<any>;
|
|
654
|
+
update(id: string, input: WebhookUpdateInput): Promise<any>;
|
|
655
|
+
delete(id: string): Promise<any>;
|
|
656
|
+
test(id: string): Promise<any>;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Log Drains Module
|
|
661
|
+
*/
|
|
662
|
+
|
|
663
|
+
interface LogDrainInput {
|
|
664
|
+
name: string;
|
|
665
|
+
type: string;
|
|
666
|
+
url: string;
|
|
667
|
+
token?: string;
|
|
668
|
+
headers?: Record<string, string>;
|
|
669
|
+
filters?: {
|
|
670
|
+
levels?: string[];
|
|
671
|
+
sources?: string[];
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
interface LogDrainUpdateInput {
|
|
675
|
+
name?: string;
|
|
676
|
+
url?: string;
|
|
677
|
+
token?: string;
|
|
678
|
+
headers?: Record<string, string>;
|
|
679
|
+
filters?: {
|
|
680
|
+
levels?: string[];
|
|
681
|
+
sources?: string[];
|
|
682
|
+
};
|
|
683
|
+
enabled?: boolean;
|
|
684
|
+
}
|
|
685
|
+
interface LogDrainsModule {
|
|
686
|
+
create(input: LogDrainInput): Promise<any>;
|
|
687
|
+
list(): Promise<any>;
|
|
688
|
+
get(id: string): Promise<any>;
|
|
689
|
+
update(id: string, input: LogDrainUpdateInput): Promise<any>;
|
|
690
|
+
delete(id: string): Promise<any>;
|
|
691
|
+
toggle(id: string, enabled: boolean): Promise<any>;
|
|
692
|
+
test(id: string): Promise<any>;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Branches Module - Database branches operations
|
|
697
|
+
*/
|
|
698
|
+
|
|
699
|
+
interface BranchesModule {
|
|
700
|
+
create(input: {
|
|
701
|
+
name: string;
|
|
702
|
+
source_branch?: string;
|
|
703
|
+
}): Promise<any>;
|
|
704
|
+
list(): Promise<any>;
|
|
705
|
+
get(id: string): Promise<any>;
|
|
706
|
+
delete(id: string): Promise<any>;
|
|
707
|
+
merge(id: string, targetBranchId: string): Promise<any>;
|
|
708
|
+
reset(id: string): Promise<any>;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Realtime Module - WebSocket subscriptions
|
|
713
|
+
*/
|
|
714
|
+
|
|
715
|
+
interface Subscription {
|
|
716
|
+
unsubscribe: () => void;
|
|
717
|
+
}
|
|
718
|
+
interface RealtimeModule {
|
|
719
|
+
subscribe<T = any>(table: string, action: RealtimeAction, callback: RealtimeCallback<T>): Promise<Subscription>;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* API Keys Module
|
|
724
|
+
*/
|
|
725
|
+
|
|
726
|
+
interface ApiKeysModule {
|
|
727
|
+
create(name: string, permissions?: string[], expiresAt?: string): Promise<any>;
|
|
728
|
+
list(): Promise<any>;
|
|
729
|
+
revoke(keyId: string): Promise<any>;
|
|
730
|
+
delete(keyId: string): Promise<any>;
|
|
731
|
+
getInstanceToken(): Promise<any>;
|
|
732
|
+
regenerateInstanceToken(): Promise<any>;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* CORS Origins Module
|
|
737
|
+
*/
|
|
738
|
+
|
|
739
|
+
interface CorsOriginsModule {
|
|
740
|
+
list(): Promise<any>;
|
|
741
|
+
create(origin: string, description?: string): Promise<any>;
|
|
742
|
+
delete(id: string): Promise<any>;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Policies Module - Row-Level Security policy management
|
|
747
|
+
*/
|
|
748
|
+
|
|
749
|
+
interface Policy {
|
|
750
|
+
id: string;
|
|
751
|
+
table_name: string;
|
|
752
|
+
action: 'select' | 'insert' | 'update' | 'delete';
|
|
753
|
+
role: string;
|
|
754
|
+
condition: string;
|
|
755
|
+
created_at?: string;
|
|
756
|
+
}
|
|
757
|
+
interface CreatePolicyInput {
|
|
758
|
+
table_name: string;
|
|
759
|
+
action: 'select' | 'insert' | 'update' | 'delete';
|
|
760
|
+
role: string;
|
|
761
|
+
condition: string;
|
|
762
|
+
}
|
|
763
|
+
interface PoliciesModule {
|
|
764
|
+
create(input: CreatePolicyInput): Promise<Policy>;
|
|
765
|
+
list(): Promise<Policy[]>;
|
|
766
|
+
delete(id: string): Promise<any>;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* IP Whitelist Module - IP-based access control
|
|
771
|
+
*/
|
|
772
|
+
|
|
773
|
+
interface IPWhitelistEntry {
|
|
774
|
+
id: string;
|
|
775
|
+
ip_address: string;
|
|
776
|
+
description: string;
|
|
777
|
+
created_at?: string;
|
|
778
|
+
}
|
|
779
|
+
interface IPWhitelistModule {
|
|
780
|
+
list(): Promise<IPWhitelistEntry[]>;
|
|
781
|
+
create(ipAddress: string, description?: string): Promise<IPWhitelistEntry>;
|
|
782
|
+
delete(id: string): Promise<any>;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Cache Management Module
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
type CacheStrategy = 'no_cache' | 'ttl_only' | 'cdc_invalidation' | 'write_through';
|
|
790
|
+
interface CacheStatus {
|
|
791
|
+
connected: boolean;
|
|
792
|
+
backend: string;
|
|
793
|
+
version: string;
|
|
794
|
+
ping_latency_ms: number;
|
|
795
|
+
circuit_state: string;
|
|
796
|
+
cdc_lag_seconds: number;
|
|
797
|
+
}
|
|
798
|
+
interface CacheStats {
|
|
799
|
+
memory_used: string;
|
|
800
|
+
memory_used_bytes: number;
|
|
801
|
+
db_size: number;
|
|
802
|
+
uptime_seconds: number;
|
|
803
|
+
ops_per_sec: number;
|
|
804
|
+
namespaces_total: number;
|
|
805
|
+
}
|
|
806
|
+
interface CachePolicy {
|
|
807
|
+
namespace: string;
|
|
808
|
+
strategy: CacheStrategy;
|
|
809
|
+
ttl_seconds: number;
|
|
810
|
+
use_versioning: boolean;
|
|
811
|
+
is_default: boolean;
|
|
812
|
+
}
|
|
813
|
+
interface CacheKey {
|
|
814
|
+
key: string;
|
|
815
|
+
ttl_seconds: number;
|
|
816
|
+
}
|
|
817
|
+
interface CacheKeysResponse {
|
|
818
|
+
keys: CacheKey[];
|
|
819
|
+
next_cursor: number;
|
|
820
|
+
has_more: boolean;
|
|
821
|
+
}
|
|
822
|
+
interface CacheKeyInspect {
|
|
823
|
+
key: string;
|
|
824
|
+
exists: boolean;
|
|
825
|
+
ttl_seconds: number;
|
|
826
|
+
size_bytes: number;
|
|
827
|
+
value_preview: string;
|
|
828
|
+
value_truncated: boolean;
|
|
829
|
+
}
|
|
830
|
+
interface CacheModule {
|
|
831
|
+
getStatus(): Promise<CacheStatus>;
|
|
832
|
+
getStats(): Promise<CacheStats>;
|
|
833
|
+
listPolicies(): Promise<{
|
|
834
|
+
policies: CachePolicy[];
|
|
835
|
+
}>;
|
|
836
|
+
updatePolicy(namespace: string, body: {
|
|
837
|
+
strategy: CacheStrategy;
|
|
838
|
+
ttl_seconds: number;
|
|
839
|
+
use_versioning: boolean;
|
|
840
|
+
}): Promise<any>;
|
|
841
|
+
removePolicy(namespace: string): Promise<any>;
|
|
842
|
+
invalidateNamespace(namespace: string): Promise<any>;
|
|
843
|
+
invalidateAll(): Promise<any>;
|
|
844
|
+
listKeys(prefix: string, cursor?: number, count?: number): Promise<CacheKeysResponse>;
|
|
845
|
+
inspectKey(key: string): Promise<CacheKeyInspect>;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Main BaaS Client - Composes all feature modules
|
|
850
|
+
*
|
|
851
|
+
* Usage:
|
|
852
|
+
* ```ts
|
|
853
|
+
* const client = new BaasClient();
|
|
854
|
+
*
|
|
855
|
+
* // Authentication
|
|
856
|
+
* await client.auth.login('user@example.com', 'password');
|
|
857
|
+
*
|
|
858
|
+
* // Database operations
|
|
859
|
+
* const schemas = await client.database.getSchemas();
|
|
860
|
+
*
|
|
861
|
+
* // Query builder (fluent API)
|
|
862
|
+
* const users = await client.from('users').select('*').limit(10).get();
|
|
863
|
+
* ```
|
|
864
|
+
*/
|
|
865
|
+
declare class BaasClient extends HttpClient {
|
|
866
|
+
readonly auth: AuthModule;
|
|
867
|
+
readonly users: UsersModule;
|
|
868
|
+
readonly database: DatabaseModule;
|
|
869
|
+
readonly storage: StorageModule;
|
|
870
|
+
readonly backups: BackupsModule;
|
|
871
|
+
readonly migrations: MigrationsModule;
|
|
872
|
+
readonly functions: FunctionsModule;
|
|
873
|
+
readonly jobs: JobsModule;
|
|
874
|
+
readonly envVars: EnvVarsModule;
|
|
875
|
+
readonly email: EmailModule;
|
|
876
|
+
readonly searchService: SearchModule;
|
|
877
|
+
readonly graphqlService: GraphQLModule;
|
|
878
|
+
readonly metrics: MetricsModule;
|
|
879
|
+
readonly audit: AuditModule;
|
|
880
|
+
readonly webhooks: WebhooksModule;
|
|
881
|
+
readonly logDrains: LogDrainsModule;
|
|
882
|
+
readonly branches: BranchesModule;
|
|
883
|
+
readonly realtime: RealtimeModule;
|
|
884
|
+
readonly apiKeys: ApiKeysModule;
|
|
885
|
+
readonly environments: EnvironmentsModule;
|
|
886
|
+
readonly corsOrigins: CorsOriginsModule;
|
|
887
|
+
readonly policies: PoliciesModule;
|
|
888
|
+
readonly ipWhitelist: IPWhitelistModule;
|
|
889
|
+
readonly cache: CacheModule;
|
|
890
|
+
constructor(url?: string, apiKey?: string, options?: ClientOptions);
|
|
891
|
+
/**
|
|
892
|
+
* Create a query builder for fluent data queries
|
|
893
|
+
*/
|
|
894
|
+
from(table: string): QueryBuilder;
|
|
895
|
+
/**
|
|
896
|
+
* Invoke a PL/pgSQL function (PostgREST `.rpc()` parity). Runs under the
|
|
897
|
+
* caller's RLS context; args bind by name and are $N-safe. Pass [params] for
|
|
898
|
+
* POST (named args in the body) or set `opts.get = true` for the GET variant.
|
|
899
|
+
*/
|
|
900
|
+
rpc(fn: string, params?: Record<string, any>, opts?: {
|
|
901
|
+
get?: boolean;
|
|
902
|
+
}): Promise<any>;
|
|
903
|
+
login(email: string, password: string): Promise<any>;
|
|
904
|
+
verifyMFA(mfaToken: string, code: string): Promise<any>;
|
|
905
|
+
getProfile(): Promise<any>;
|
|
906
|
+
register(email: string, password: string): Promise<any>;
|
|
907
|
+
forgotPassword(email: string): Promise<any>;
|
|
908
|
+
resetPassword(token: string, newPassword: string): Promise<any>;
|
|
909
|
+
validateResetToken(token: string): Promise<any>;
|
|
910
|
+
verifyEmail(token: string): Promise<any>;
|
|
911
|
+
requestEmailVerification(): Promise<any>;
|
|
912
|
+
getAuthProviders(): Promise<any>;
|
|
913
|
+
getAuthProvider(provider: string): Promise<any>;
|
|
914
|
+
configureAuthProvider(provider: string, clientID: string, clientSecret: string, enabled: boolean): Promise<any>;
|
|
915
|
+
listUsers(limit?: number, offset?: number): Promise<any>;
|
|
916
|
+
updateUser(id: string, updates: any): Promise<any>;
|
|
917
|
+
deleteUser(id: string): Promise<any>;
|
|
918
|
+
raw(query: string): Promise<any>;
|
|
919
|
+
getSchemas(options?: any): Promise<any>;
|
|
920
|
+
getSchema(name: string): Promise<any>;
|
|
921
|
+
createTable(tableName: string, definition: any): Promise<any>;
|
|
922
|
+
dropTable(tableName: string): Promise<any>;
|
|
923
|
+
renameTable(tableName: string, newName: string): Promise<any>;
|
|
924
|
+
addColumn(tableName: string, column: any): Promise<any>;
|
|
925
|
+
dropColumn(tableName: string, columnName: string): Promise<any>;
|
|
926
|
+
modifyColumn(tableName: string, columnName: string, changes: any): Promise<any>;
|
|
927
|
+
renameColumn(tableName: string, columnName: string, newName: string): Promise<any>;
|
|
928
|
+
setColumnDefault(tableName: string, columnName: string, defaultValue: string | null): Promise<any>;
|
|
929
|
+
addForeignKey(tableName: string, fk: any): Promise<any>;
|
|
930
|
+
listForeignKeys(tableName: string): Promise<any>;
|
|
931
|
+
dropForeignKey(tableName: string, constraintName: string): Promise<any>;
|
|
932
|
+
addUniqueConstraint(tableName: string, columnName: string): Promise<any>;
|
|
933
|
+
dropConstraint(tableName: string, constraintName: string): Promise<any>;
|
|
934
|
+
queryData(tableName: string, options: any): Promise<any>;
|
|
935
|
+
downloadExport(tableName: string, format: 'sql' | 'csv' | 'backup', filters?: any[]): Promise<any>;
|
|
936
|
+
upload(file: File, bucketId?: string): Promise<StorageFile>;
|
|
937
|
+
listStorageFiles(): Promise<StorageFile[]>;
|
|
938
|
+
getStorageFile(fileId: string): Promise<StorageFileWithUrl>;
|
|
939
|
+
deleteStorageFile(fileId: string): Promise<void>;
|
|
940
|
+
createStorageBucket(name: string, isPublic?: boolean): Promise<StorageBucket>;
|
|
941
|
+
listStorageBuckets(): Promise<StorageBucket[]>;
|
|
942
|
+
getStorageBucket(bucketId: string): Promise<StorageBucket>;
|
|
943
|
+
deleteStorageBucket(bucketId: string): Promise<void>;
|
|
944
|
+
listStorageBucketFiles(bucketId: string): Promise<StorageFile[]>;
|
|
945
|
+
invokeFunction(id: string, data?: any): Promise<any>;
|
|
946
|
+
createApiKey(name: string, permissions?: string[], expiresAt?: string): Promise<any>;
|
|
947
|
+
listApiKeys(): Promise<any>;
|
|
948
|
+
revokeApiKey(keyId: string): Promise<any>;
|
|
949
|
+
deleteApiKey(keyId: string): Promise<any>;
|
|
950
|
+
getInstanceToken(): Promise<any>;
|
|
951
|
+
regenerateInstanceToken(): Promise<any>;
|
|
952
|
+
createBackup(options?: any): Promise<any>;
|
|
953
|
+
listBackups(): Promise<any>;
|
|
954
|
+
getBackup(backupId: string): Promise<any>;
|
|
955
|
+
restoreBackup(backupId: string): Promise<any>;
|
|
956
|
+
deleteBackup(backupId: string): Promise<any>;
|
|
957
|
+
getBackupDownloadUrl(backupId: string): string;
|
|
958
|
+
listBackupTables(): Promise<any>;
|
|
959
|
+
importFile(formData: FormData): Promise<any>;
|
|
960
|
+
search(query: string, options?: any): Promise<any>;
|
|
961
|
+
createSearchIndex(table: string, columns: string[]): Promise<any>;
|
|
962
|
+
graphql(query: string, variables?: Record<string, any>): Promise<any>;
|
|
963
|
+
getGraphQLPlaygroundUrl(): string;
|
|
964
|
+
createMigration(input: any): Promise<any>;
|
|
965
|
+
listMigrations(): Promise<any>;
|
|
966
|
+
getMigration(id: string): Promise<any>;
|
|
967
|
+
applyMigration(id: string): Promise<any>;
|
|
968
|
+
rollbackMigration(id: string): Promise<any>;
|
|
969
|
+
deleteMigration(id: string): Promise<any>;
|
|
970
|
+
generateMigration(tableName: string, changes: any[]): Promise<any>;
|
|
971
|
+
sendEmail(input: any): Promise<any>;
|
|
972
|
+
getEmailConfig(): Promise<any>;
|
|
973
|
+
saveEmailConfig(config: any): Promise<any>;
|
|
974
|
+
createEmailTemplate(template: any): Promise<any>;
|
|
975
|
+
listEmailTemplates(): Promise<any>;
|
|
976
|
+
getEmailTemplate(id: string): Promise<any>;
|
|
977
|
+
updateEmailTemplate(id: string, template: any): Promise<any>;
|
|
978
|
+
deleteEmailTemplate(id: string): Promise<any>;
|
|
979
|
+
getEmailLogs(options?: any): Promise<any>;
|
|
980
|
+
getDashboardStats(): Promise<any>;
|
|
981
|
+
getRequestLogs(options?: any): Promise<any>;
|
|
982
|
+
getApplicationLogs(options?: any): Promise<any>;
|
|
983
|
+
getMetricTimeseries(metric: string, options?: any): Promise<any>;
|
|
984
|
+
createJob(input: any): Promise<any>;
|
|
985
|
+
listJobs(): Promise<any>;
|
|
986
|
+
getJob(id: string): Promise<any>;
|
|
987
|
+
updateJob(id: string, input: any): Promise<any>;
|
|
988
|
+
deleteJob(id: string): Promise<any>;
|
|
989
|
+
toggleJob(id: string, enabled: boolean): Promise<any>;
|
|
990
|
+
runJobNow(id: string): Promise<any>;
|
|
991
|
+
getJobExecutions(id: string, limit?: number): Promise<any>;
|
|
992
|
+
createEnvVar(input: any): Promise<any>;
|
|
993
|
+
listEnvVars(): Promise<any>;
|
|
994
|
+
getEnvVar(id: string): Promise<any>;
|
|
995
|
+
updateEnvVar(id: string, value: string): Promise<any>;
|
|
996
|
+
deleteEnvVar(id: string): Promise<any>;
|
|
997
|
+
createBranch(input: any): Promise<any>;
|
|
998
|
+
listBranches(): Promise<any>;
|
|
999
|
+
getBranch(id: string): Promise<any>;
|
|
1000
|
+
deleteBranch(id: string): Promise<any>;
|
|
1001
|
+
mergeBranch(id: string, targetBranchId: string): Promise<any>;
|
|
1002
|
+
resetBranch(id: string): Promise<any>;
|
|
1003
|
+
createLogDrain(input: any): Promise<any>;
|
|
1004
|
+
listLogDrains(): Promise<any>;
|
|
1005
|
+
getLogDrain(id: string): Promise<any>;
|
|
1006
|
+
updateLogDrain(id: string, input: any): Promise<any>;
|
|
1007
|
+
deleteLogDrain(id: string): Promise<any>;
|
|
1008
|
+
toggleLogDrain(id: string, enabled: boolean): Promise<any>;
|
|
1009
|
+
testLogDrain(id: string): Promise<any>;
|
|
1010
|
+
listWebhooks(): Promise<any>;
|
|
1011
|
+
getWebhook(id: string): Promise<any>;
|
|
1012
|
+
createWebhook(input: any): Promise<any>;
|
|
1013
|
+
updateWebhook(id: string, input: any): Promise<any>;
|
|
1014
|
+
deleteWebhook(id: string): Promise<any>;
|
|
1015
|
+
testWebhook(id: string): Promise<any>;
|
|
1016
|
+
listAuditLogs(options?: any): Promise<any>;
|
|
1017
|
+
getAuditActions(): Promise<any>;
|
|
1018
|
+
exportAuditLogs(format: 'csv' | 'json', options?: any): Promise<any>;
|
|
1019
|
+
previewPurgeAuditLogs(olderThanDays: number): Promise<any>;
|
|
1020
|
+
purgeAuditLogs(olderThanDays: number): Promise<any>;
|
|
1021
|
+
subscribe<T = any>(table: string, action: RealtimeAction, callback: RealtimeCallback<T>): Promise<Subscription>;
|
|
1022
|
+
getEnvironmentStatus(): Promise<EnvironmentStatus>;
|
|
1023
|
+
initTestEnvironment(): Promise<any>;
|
|
1024
|
+
promoteTestToProd(): Promise<PromoteResult>;
|
|
1025
|
+
revertTestEnvironment(): Promise<any>;
|
|
1026
|
+
listCorsOrigins(): Promise<any>;
|
|
1027
|
+
addCorsOrigin(origin: string, description?: string): Promise<any>;
|
|
1028
|
+
deleteCorsOrigin(id: string): Promise<any>;
|
|
1029
|
+
listPolicies(): Promise<Policy[]>;
|
|
1030
|
+
createPolicy(input: any): Promise<Policy>;
|
|
1031
|
+
deletePolicy(id: string): Promise<any>;
|
|
1032
|
+
listIPWhitelist(): Promise<IPWhitelistEntry[]>;
|
|
1033
|
+
addIPWhitelistEntry(ipAddress: string, description?: string): Promise<IPWhitelistEntry>;
|
|
1034
|
+
deleteIPWhitelistEntry(id: string): Promise<any>;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
export { type ApiKeysModule, type ApiResponse, type ApplicationLogsOptions, type AuditLogsOptions, type AuditModule, type AuthModule, BaasClient, type BackupsModule, type BranchesModule, type CacheKey, type CacheKeyInspect, type CacheKeysResponse, type CacheModule, type CachePolicy, type CacheStats, type CacheStatus, type CacheStrategy, type CorsOriginsModule, type CreatePolicyInput, type DatabaseModule, type EmailConfig, type EmailModule, type EmailTemplate, type EnvVarsModule, type EnvironmentsModule, type FunctionsModule, type GraphQLModule, HttpClient, type HttpMethod, type IPWhitelistEntry, type IPWhitelistModule, type JobInput, type JobUpdateInput, type JobsModule, type LogDrainInput, type LogDrainUpdateInput, type LogDrainsModule, type MetricsModule, type MigrationsModule, type PaginationOptions, type PoliciesModule, type Policy, 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 };
|