@linabase/js 0.1.1 → 0.2.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.
@@ -0,0 +1,441 @@
1
+ type RequestFn$3 = (path: string, options?: RequestInit) => Promise<Response>;
2
+ interface PostgrestError {
3
+ message: string;
4
+ code?: string;
5
+ details?: string;
6
+ hint?: string;
7
+ }
8
+ interface QueryResult<T = any> {
9
+ data: T[] | null;
10
+ error: PostgrestError | null;
11
+ count: number | null;
12
+ }
13
+ interface SingleQueryResult<T = any> {
14
+ data: T | null;
15
+ error: PostgrestError | null;
16
+ count: number | null;
17
+ }
18
+ interface CsvQueryResult {
19
+ data: string | null;
20
+ error: PostgrestError | null;
21
+ count: number | null;
22
+ }
23
+ declare class DatabaseClient {
24
+ private request;
25
+ private table;
26
+ private params;
27
+ private method;
28
+ private body;
29
+ private preferHeaders;
30
+ private _single;
31
+ private _maybeSingle;
32
+ private _throwOnError;
33
+ private _csv;
34
+ private _abortSignal;
35
+ private _schema;
36
+ constructor(request: RequestFn$3, table: string);
37
+ /** Select columns. Supports nested joins: "*, comments(*)" and aliases: "full_name:name" */
38
+ select(columns?: string, options?: {
39
+ count?: "exact" | "estimated" | "planned";
40
+ head?: boolean;
41
+ }): this;
42
+ insert(data: Record<string, any> | Record<string, any>[]): this;
43
+ /** Upsert: insert or update on conflict. Uses merge-duplicates by default. */
44
+ upsert(data: Record<string, any> | Record<string, any>[], options?: {
45
+ ignoreDuplicates?: boolean;
46
+ onConflict?: string;
47
+ }): this;
48
+ update(data: Record<string, any>): this;
49
+ delete(): this;
50
+ eq(column: string, value: any): this;
51
+ neq(column: string, value: any): this;
52
+ gt(column: string, value: any): this;
53
+ gte(column: string, value: any): this;
54
+ lt(column: string, value: any): this;
55
+ lte(column: string, value: any): this;
56
+ like(column: string, pattern: string): this;
57
+ ilike(column: string, pattern: string): this;
58
+ /** Regex match (~) when called with (column, pattern). Object-based multi-column filter when called with ({ col: val }). */
59
+ match(columnOrFilter: string | Record<string, any>, pattern?: string): this;
60
+ /** Case-insensitive regex match (~*) */
61
+ imatch(column: string, pattern: string): this;
62
+ in(column: string, values: any[]): this;
63
+ /** Contains (@>) - array or JSONB containment */
64
+ contains(column: string, value: any): this;
65
+ /** Contained by (<@) */
66
+ containedBy(column: string, value: any): this;
67
+ /** Overlap (&&) - ranges or arrays */
68
+ overlaps(column: string, value: any): this;
69
+ is(column: string, value: "null" | "true" | "false" | null | boolean): this;
70
+ /** IS DISTINCT FROM */
71
+ isDistinct(column: string, value: any): this;
72
+ /** Negate a filter: not.eq, not.in, not.is, etc. */
73
+ not(column: string, operator: string, value: any): this;
74
+ /** OR filter: or("age.gt.20,name.eq.John") */
75
+ or(filters: string): this;
76
+ /** to_tsquery */
77
+ textSearch(column: string, query: string, options?: {
78
+ type?: "plain" | "phrase" | "websearch";
79
+ }): this;
80
+ order(column: string, options?: {
81
+ ascending?: boolean;
82
+ nullsFirst?: boolean;
83
+ }): this;
84
+ limit(count: number): this;
85
+ offset(count: number): this;
86
+ /** Request exact, estimated, or planned count via Prefer header */
87
+ count(type?: "exact" | "estimated" | "planned"): this;
88
+ /** Return a single object instead of an array. Errors if 0 or >1 rows. */
89
+ single(): this;
90
+ /** Return a single object or null. Errors only if >1 rows. */
91
+ maybeSingle(): this;
92
+ /** Range-based pagination: range(0, 9) fetches the first 10 rows. */
93
+ range(from: number, to: number): this;
94
+ /** Throw an error instead of returning it in the result object. */
95
+ throwOnError(): this;
96
+ /** Request CSV format. Returns raw CSV text in data instead of parsed objects. */
97
+ csv(): this;
98
+ /** Pass an AbortSignal for request cancellation. */
99
+ abortSignal(signal: AbortSignal): this;
100
+ /** Switch schema. Sets Accept-Profile (GET) or Content-Profile (POST/PATCH/DELETE). */
101
+ schema(schemaName: string): this;
102
+ private reset;
103
+ execute(): Promise<QueryResult | SingleQueryResult | CsvQueryResult>;
104
+ /**
105
+ * Makes DatabaseClient thenable (await-able). Resolves to
106
+ * `{ data, error, count }` where data is permissively typed so
107
+ * callers can access properties without generated database types.
108
+ */
109
+ then<T = any, U = never>(onfulfilled?: ((value: any) => T | PromiseLike<T>) | null, onrejected?: ((reason: any) => U | PromiseLike<U>) | null): Promise<T | U>;
110
+ }
111
+ declare class RpcClient {
112
+ private request;
113
+ constructor(request: RequestFn$3);
114
+ /** Call a Postgres function: rpc("my_function", { arg1: "value" }, { count: "exact" }) */
115
+ call(fn: string, args?: Record<string, any>, options?: {
116
+ count?: "exact" | "estimated" | "planned";
117
+ throwOnError?: boolean;
118
+ }): Promise<QueryResult>;
119
+ }
120
+
121
+ type RequestFn$2 = (path: string, options?: RequestInit) => Promise<Response>;
122
+ declare class StorageClient {
123
+ private request;
124
+ private baseUrl;
125
+ constructor(request: RequestFn$2, baseUrl?: string);
126
+ from(bucket: string): BucketClient;
127
+ listBuckets(): Promise<{
128
+ data: any[];
129
+ error: any;
130
+ }>;
131
+ createBucket(name: string, options?: {
132
+ public?: boolean;
133
+ }): Promise<{
134
+ data: any;
135
+ error: any;
136
+ }>;
137
+ }
138
+ declare class BucketClient {
139
+ private request;
140
+ private bucket;
141
+ private baseUrl;
142
+ constructor(request: RequestFn$2, bucket: string, baseUrl?: string);
143
+ upload(path: string, file: Blob | File | ArrayBuffer, options?: {
144
+ contentType?: string;
145
+ upsert?: boolean;
146
+ headers?: Record<string, string>;
147
+ }): Promise<{
148
+ data: any;
149
+ error: any;
150
+ }>;
151
+ download(path: string): Promise<{
152
+ data: Blob | null;
153
+ error: any;
154
+ }>;
155
+ list(prefix?: string): Promise<{
156
+ data: any[];
157
+ error: any;
158
+ }>;
159
+ remove(pathOrPaths: string | string[]): Promise<{
160
+ data: any;
161
+ error: any;
162
+ }>;
163
+ getPublicUrl(path: string, options?: {
164
+ transform?: {
165
+ width?: number;
166
+ height?: number;
167
+ quality?: number;
168
+ format?: string;
169
+ };
170
+ }): {
171
+ data: {
172
+ publicUrl: string;
173
+ };
174
+ };
175
+ createSignedUrl(path: string, expiresIn: number): Promise<{
176
+ data: {
177
+ signedUrl: string;
178
+ } | null;
179
+ error: any;
180
+ }>;
181
+ createSignedUrls(paths: string[], expiresIn: number): Promise<{
182
+ data: Array<{
183
+ path: string;
184
+ signedUrl: string;
185
+ }> | null;
186
+ error: any;
187
+ }>;
188
+ createSignedUploadUrl(path: string): Promise<{
189
+ data: {
190
+ signedUrl: string;
191
+ token: string;
192
+ path: string;
193
+ } | null;
194
+ error: any;
195
+ }>;
196
+ move(fromPath: string, toPath: string): Promise<{
197
+ error: any;
198
+ }>;
199
+ copy(fromPath: string, toPath: string): Promise<{
200
+ error: any;
201
+ }>;
202
+ }
203
+
204
+ type RequestFn$1 = (path: string, options?: RequestInit) => Promise<Response>;
205
+ type OAuthProvider = "google" | "github" | "apple" | "microsoft" | "linkedin" | "slack" | "gitlab" | "bitbucket" | "discord" | "facebook" | "twitter" | "reddit" | "twitch" | "tiktok" | "spotify" | "telegram" | "roblox";
206
+ interface AuthSession {
207
+ access_token: string;
208
+ refresh_token: string;
209
+ token_type: string;
210
+ expires_in: number;
211
+ expires_at: number;
212
+ user: AuthUser;
213
+ }
214
+ interface AuthUser {
215
+ id: string;
216
+ email: string | null;
217
+ email_confirmed_at: string | null;
218
+ role: string;
219
+ raw_user_meta_data: Record<string, unknown>;
220
+ raw_app_meta_data: Record<string, unknown>;
221
+ /** Alias for raw_user_meta_data (Supabase compatibility) */
222
+ user_metadata: Record<string, unknown>;
223
+ created_at: string;
224
+ updated_at: string;
225
+ }
226
+ declare class AuthClient {
227
+ private request;
228
+ private listeners;
229
+ private currentSession;
230
+ /**
231
+ * Callback that the parent LinabaseClient can set to update the Authorization
232
+ * header when the user signs in/out or a token is refreshed.
233
+ */
234
+ onSessionChange: ((session: AuthSession | null) => void) | null;
235
+ constructor(request: RequestFn$1);
236
+ /**
237
+ * Set (or clear) the current session. Use this to restore a persisted
238
+ * session on app launch (e.g., from AsyncStorage / SecureStore).
239
+ * Emits INITIAL_SESSION to onAuthStateChange listeners.
240
+ */
241
+ setSession(session: AuthSession | null): void;
242
+ signUp(params: {
243
+ email: string;
244
+ password: string;
245
+ data?: Record<string, unknown>;
246
+ }): Promise<{
247
+ data: AuthSession | null;
248
+ error: any;
249
+ }>;
250
+ signIn(params: {
251
+ email: string;
252
+ password: string;
253
+ }): Promise<{
254
+ data: AuthSession | null;
255
+ error: any;
256
+ }>;
257
+ /** Supabase-compatible alias for signIn */
258
+ signInWithPassword(params: {
259
+ email: string;
260
+ password: string;
261
+ }): Promise<{
262
+ data: AuthSession | null;
263
+ error: any;
264
+ }>;
265
+ signInWithIdToken(params: {
266
+ provider: OAuthProvider;
267
+ token: string;
268
+ nonce?: string;
269
+ }): Promise<{
270
+ data: AuthSession | null;
271
+ error: any;
272
+ }>;
273
+ signInWithOAuth(params: {
274
+ provider: OAuthProvider;
275
+ redirectTo?: string;
276
+ }): {
277
+ url: string;
278
+ };
279
+ signOut(): Promise<{
280
+ error: any;
281
+ }>;
282
+ getSession(): Promise<{
283
+ data: {
284
+ session: AuthSession | null;
285
+ };
286
+ error: any;
287
+ }>;
288
+ getUser(): Promise<{
289
+ data: {
290
+ user: AuthUser | null;
291
+ };
292
+ error: any;
293
+ }>;
294
+ refreshSession(): Promise<{
295
+ data: AuthSession | null;
296
+ error: any;
297
+ }>;
298
+ resetPasswordForEmail(email: string, _options?: {
299
+ redirectTo?: string;
300
+ }): Promise<{
301
+ error: any;
302
+ }>;
303
+ updatePassword(newPassword: string): Promise<{
304
+ error: any;
305
+ }>;
306
+ updateUser(attributes: {
307
+ email?: string;
308
+ password?: string;
309
+ data?: Record<string, any>;
310
+ }): Promise<{
311
+ data: {
312
+ user: AuthUser | null;
313
+ };
314
+ error: any;
315
+ }>;
316
+ signInWithOtp(params: {
317
+ email: string;
318
+ options?: {
319
+ emailRedirectTo?: string;
320
+ };
321
+ }): Promise<{
322
+ data: any;
323
+ error: any;
324
+ }>;
325
+ verifyOtp(params: {
326
+ email?: string;
327
+ phone?: string;
328
+ token: string;
329
+ type?: "email" | "sms" | "magiclink" | "signup" | "recovery";
330
+ }): Promise<{
331
+ data: any;
332
+ error: any;
333
+ }>;
334
+ get admin(): {
335
+ listUsers(params?: {
336
+ page?: number;
337
+ per_page?: number;
338
+ }): Promise<{
339
+ data: any;
340
+ error: any;
341
+ }>;
342
+ createUser(params: {
343
+ email: string;
344
+ password?: string;
345
+ user_metadata?: Record<string, any>;
346
+ email_confirm?: boolean;
347
+ }): Promise<{
348
+ data: any;
349
+ error: any;
350
+ }>;
351
+ getUserById(id: string): Promise<{
352
+ data: any;
353
+ error: any;
354
+ }>;
355
+ updateUserById(id: string, attributes: Record<string, any>): Promise<{
356
+ data: any;
357
+ error: any;
358
+ }>;
359
+ deleteUser(id: string): Promise<{
360
+ error: any;
361
+ }>;
362
+ };
363
+ get mfa(): {
364
+ enroll(params: {
365
+ factorType: "totp";
366
+ friendlyName?: string;
367
+ }): Promise<{
368
+ data: any;
369
+ error: any;
370
+ }>;
371
+ challenge(params: {
372
+ factorId: string;
373
+ }): Promise<{
374
+ data: any;
375
+ error: any;
376
+ }>;
377
+ verify(params: {
378
+ factorId: string;
379
+ challengeId: string;
380
+ code: string;
381
+ }): Promise<{
382
+ data: any;
383
+ error: any;
384
+ }>;
385
+ unenroll(params: {
386
+ factorId: string;
387
+ }): Promise<{
388
+ error: any;
389
+ }>;
390
+ listFactors(): Promise<{
391
+ data: any;
392
+ error: any;
393
+ }>;
394
+ };
395
+ onAuthStateChange(callback: (event: string, session: AuthSession | null) => void): {
396
+ unsubscribe: () => void;
397
+ };
398
+ private emit;
399
+ private parseAuthResponse;
400
+ }
401
+
402
+ type RequestFn = (path: string, options?: RequestInit) => Promise<Response>;
403
+ interface FunctionInvokeOptions {
404
+ body?: Record<string, any>;
405
+ method?: "GET" | "POST";
406
+ headers?: Record<string, string>;
407
+ }
408
+ declare class FunctionsClient {
409
+ private request;
410
+ constructor(request: RequestFn);
411
+ invoke<T = any>(name: string, options?: FunctionInvokeOptions): Promise<{
412
+ data: T | null;
413
+ error: any;
414
+ }>;
415
+ }
416
+
417
+ interface LinabaseConfig {
418
+ url: string;
419
+ anonKey?: string;
420
+ serviceRoleKey?: string;
421
+ }
422
+ interface LinabaseClient {
423
+ from: (table: string) => DatabaseClient;
424
+ schema: (schemaName: string) => {
425
+ from: (table: string) => DatabaseClient;
426
+ };
427
+ rpc: (fn: string, args?: Record<string, any>) => ReturnType<RpcClient["call"]>;
428
+ storage: StorageClient;
429
+ auth: AuthClient;
430
+ functions: FunctionsClient;
431
+ /** Realtime channel (stub; not yet supported). Returns a chainable no-op. */
432
+ channel: (name: string) => any;
433
+ /** Remove a realtime channel (stub; not yet supported). */
434
+ removeChannel: (channel: any) => void;
435
+ generateTypes: () => Promise<string>;
436
+ /** Returns a new client that targets the given branch via X-Branch header. */
437
+ branch: (slug: string) => LinabaseClient;
438
+ }
439
+ declare function createClient(config: LinabaseConfig): LinabaseClient;
440
+
441
+ export { AuthClient, type AuthSession, type AuthUser, BucketClient, type CsvQueryResult, DatabaseClient, type FunctionInvokeOptions, FunctionsClient, type LinabaseClient, type LinabaseConfig, type OAuthProvider, type PostgrestError, type QueryResult, RpcClient, type SingleQueryResult, StorageClient, createClient };
package/dist/index.d.ts CHANGED
@@ -1,23 +1,23 @@
1
- type RequestFn$2 = (path: string, options?: RequestInit) => Promise<Response>;
1
+ type RequestFn$3 = (path: string, options?: RequestInit) => Promise<Response>;
2
+ interface PostgrestError {
3
+ message: string;
4
+ code?: string;
5
+ details?: string;
6
+ hint?: string;
7
+ }
2
8
  interface QueryResult<T = any> {
3
9
  data: T[] | null;
4
- error: {
5
- message: string;
6
- } | null;
10
+ error: PostgrestError | null;
7
11
  count: number | null;
8
12
  }
9
13
  interface SingleQueryResult<T = any> {
10
14
  data: T | null;
11
- error: {
12
- message: string;
13
- } | null;
15
+ error: PostgrestError | null;
14
16
  count: number | null;
15
17
  }
16
18
  interface CsvQueryResult {
17
19
  data: string | null;
18
- error: {
19
- message: string;
20
- } | null;
20
+ error: PostgrestError | null;
21
21
  count: number | null;
22
22
  }
23
23
  declare class DatabaseClient {
@@ -33,13 +33,17 @@ declare class DatabaseClient {
33
33
  private _csv;
34
34
  private _abortSignal;
35
35
  private _schema;
36
- constructor(request: RequestFn$2, table: string);
36
+ constructor(request: RequestFn$3, table: string);
37
37
  /** Select columns. Supports nested joins: "*, comments(*)" and aliases: "full_name:name" */
38
- select(columns?: string): this;
38
+ select(columns?: string, options?: {
39
+ count?: "exact" | "estimated" | "planned";
40
+ head?: boolean;
41
+ }): this;
39
42
  insert(data: Record<string, any> | Record<string, any>[]): this;
40
43
  /** Upsert: insert or update on conflict. Uses merge-duplicates by default. */
41
44
  upsert(data: Record<string, any> | Record<string, any>[], options?: {
42
45
  ignoreDuplicates?: boolean;
46
+ onConflict?: string;
43
47
  }): this;
44
48
  update(data: Record<string, any>): this;
45
49
  delete(): this;
@@ -51,8 +55,8 @@ declare class DatabaseClient {
51
55
  lte(column: string, value: any): this;
52
56
  like(column: string, pattern: string): this;
53
57
  ilike(column: string, pattern: string): this;
54
- /** Regex match (~) */
55
- match(column: string, pattern: string): this;
58
+ /** Regex match (~) when called with (column, pattern). Object-based multi-column filter when called with ({ col: val }). */
59
+ match(columnOrFilter: string | Record<string, any>, pattern?: string): this;
56
60
  /** Case-insensitive regex match (~*) */
57
61
  imatch(column: string, pattern: string): this;
58
62
  in(column: string, values: any[]): this;
@@ -62,7 +66,7 @@ declare class DatabaseClient {
62
66
  containedBy(column: string, value: any): this;
63
67
  /** Overlap (&&) - ranges or arrays */
64
68
  overlaps(column: string, value: any): this;
65
- is(column: string, value: "null" | "true" | "false"): this;
69
+ is(column: string, value: "null" | "true" | "false" | null | boolean): this;
66
70
  /** IS DISTINCT FROM */
67
71
  isDistinct(column: string, value: any): this;
68
72
  /** Negate a filter: not.eq, not.in, not.is, etc. */
@@ -97,11 +101,16 @@ declare class DatabaseClient {
97
101
  schema(schemaName: string): this;
98
102
  private reset;
99
103
  execute(): Promise<QueryResult | SingleQueryResult | CsvQueryResult>;
100
- then(resolve: (value: QueryResult | SingleQueryResult | CsvQueryResult) => void, reject?: (reason: any) => void): Promise<void>;
104
+ /**
105
+ * Makes DatabaseClient thenable (await-able). Resolves to
106
+ * `{ data, error, count }` where data is permissively typed so
107
+ * callers can access properties without generated database types.
108
+ */
109
+ then<T = any, U = never>(onfulfilled?: ((value: any) => T | PromiseLike<T>) | null, onrejected?: ((reason: any) => U | PromiseLike<U>) | null): Promise<T | U>;
101
110
  }
102
111
  declare class RpcClient {
103
112
  private request;
104
- constructor(request: RequestFn$2);
113
+ constructor(request: RequestFn$3);
105
114
  /** Call a Postgres function: rpc("my_function", { arg1: "value" }, { count: "exact" }) */
106
115
  call(fn: string, args?: Record<string, any>, options?: {
107
116
  count?: "exact" | "estimated" | "planned";
@@ -109,11 +118,11 @@ declare class RpcClient {
109
118
  }): Promise<QueryResult>;
110
119
  }
111
120
 
112
- type RequestFn$1 = (path: string, options?: RequestInit) => Promise<Response>;
121
+ type RequestFn$2 = (path: string, options?: RequestInit) => Promise<Response>;
113
122
  declare class StorageClient {
114
123
  private request;
115
124
  private baseUrl;
116
- constructor(request: RequestFn$1, baseUrl?: string);
125
+ constructor(request: RequestFn$2, baseUrl?: string);
117
126
  from(bucket: string): BucketClient;
118
127
  listBuckets(): Promise<{
119
128
  data: any[];
@@ -130,9 +139,11 @@ declare class BucketClient {
130
139
  private request;
131
140
  private bucket;
132
141
  private baseUrl;
133
- constructor(request: RequestFn$1, bucket: string, baseUrl?: string);
142
+ constructor(request: RequestFn$2, bucket: string, baseUrl?: string);
134
143
  upload(path: string, file: Blob | File | ArrayBuffer, options?: {
135
144
  contentType?: string;
145
+ upsert?: boolean;
146
+ headers?: Record<string, string>;
136
147
  }): Promise<{
137
148
  data: any;
138
149
  error: any;
@@ -141,11 +152,12 @@ declare class BucketClient {
141
152
  data: Blob | null;
142
153
  error: any;
143
154
  }>;
144
- list(): Promise<{
155
+ list(prefix?: string): Promise<{
145
156
  data: any[];
146
157
  error: any;
147
158
  }>;
148
- remove(path: string): Promise<{
159
+ remove(pathOrPaths: string | string[]): Promise<{
160
+ data: any;
149
161
  error: any;
150
162
  }>;
151
163
  getPublicUrl(path: string, options?: {
@@ -189,7 +201,7 @@ declare class BucketClient {
189
201
  }>;
190
202
  }
191
203
 
192
- type RequestFn = (path: string, options?: RequestInit) => Promise<Response>;
204
+ type RequestFn$1 = (path: string, options?: RequestInit) => Promise<Response>;
193
205
  type OAuthProvider = "google" | "github" | "apple" | "microsoft" | "linkedin" | "slack" | "gitlab" | "bitbucket" | "discord" | "facebook" | "twitter" | "reddit" | "twitch" | "tiktok" | "spotify" | "telegram" | "roblox";
194
206
  interface AuthSession {
195
207
  access_token: string;
@@ -206,6 +218,8 @@ interface AuthUser {
206
218
  role: string;
207
219
  raw_user_meta_data: Record<string, unknown>;
208
220
  raw_app_meta_data: Record<string, unknown>;
221
+ /** Alias for raw_user_meta_data (Supabase compatibility) */
222
+ user_metadata: Record<string, unknown>;
209
223
  created_at: string;
210
224
  updated_at: string;
211
225
  }
@@ -218,8 +232,13 @@ declare class AuthClient {
218
232
  * header when the user signs in/out or a token is refreshed.
219
233
  */
220
234
  onSessionChange: ((session: AuthSession | null) => void) | null;
221
- constructor(request: RequestFn);
222
- private setSession;
235
+ constructor(request: RequestFn$1);
236
+ /**
237
+ * Set (or clear) the current session. Use this to restore a persisted
238
+ * session on app launch (e.g., from AsyncStorage / SecureStore).
239
+ * Emits INITIAL_SESSION to onAuthStateChange listeners.
240
+ */
241
+ setSession(session: AuthSession | null): void;
223
242
  signUp(params: {
224
243
  email: string;
225
244
  password: string;
@@ -243,6 +262,14 @@ declare class AuthClient {
243
262
  data: AuthSession | null;
244
263
  error: any;
245
264
  }>;
265
+ signInWithIdToken(params: {
266
+ provider: OAuthProvider;
267
+ token: string;
268
+ nonce?: string;
269
+ }): Promise<{
270
+ data: AuthSession | null;
271
+ error: any;
272
+ }>;
246
273
  signInWithOAuth(params: {
247
274
  provider: OAuthProvider;
248
275
  redirectTo?: string;
@@ -372,6 +399,21 @@ declare class AuthClient {
372
399
  private parseAuthResponse;
373
400
  }
374
401
 
402
+ type RequestFn = (path: string, options?: RequestInit) => Promise<Response>;
403
+ interface FunctionInvokeOptions {
404
+ body?: Record<string, any>;
405
+ method?: "GET" | "POST";
406
+ headers?: Record<string, string>;
407
+ }
408
+ declare class FunctionsClient {
409
+ private request;
410
+ constructor(request: RequestFn);
411
+ invoke<T = any>(name: string, options?: FunctionInvokeOptions): Promise<{
412
+ data: T | null;
413
+ error: any;
414
+ }>;
415
+ }
416
+
375
417
  interface LinabaseConfig {
376
418
  url: string;
377
419
  anonKey?: string;
@@ -385,8 +427,15 @@ interface LinabaseClient {
385
427
  rpc: (fn: string, args?: Record<string, any>) => ReturnType<RpcClient["call"]>;
386
428
  storage: StorageClient;
387
429
  auth: AuthClient;
430
+ functions: FunctionsClient;
431
+ /** Realtime channel (stub; not yet supported). Returns a chainable no-op. */
432
+ channel: (name: string) => any;
433
+ /** Remove a realtime channel (stub; not yet supported). */
434
+ removeChannel: (channel: any) => void;
388
435
  generateTypes: () => Promise<string>;
436
+ /** Returns a new client that targets the given branch via X-Branch header. */
437
+ branch: (slug: string) => LinabaseClient;
389
438
  }
390
439
  declare function createClient(config: LinabaseConfig): LinabaseClient;
391
440
 
392
- export { AuthClient, BucketClient, type CsvQueryResult, DatabaseClient, type LinabaseClient, type LinabaseConfig, type OAuthProvider, type QueryResult, RpcClient, type SingleQueryResult, StorageClient, createClient };
441
+ export { AuthClient, type AuthSession, type AuthUser, BucketClient, type CsvQueryResult, DatabaseClient, type FunctionInvokeOptions, FunctionsClient, type LinabaseClient, type LinabaseConfig, type OAuthProvider, type PostgrestError, type QueryResult, RpcClient, type SingleQueryResult, StorageClient, createClient };