@ragable/sdk 0.5.1 → 0.6.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/dist/index.d.ts CHANGED
@@ -66,6 +66,10 @@ type TableRow<D extends RagableDatabase, T extends RagableTableNames<D>> = [keyo
66
66
  type TableInsertRow<D extends RagableDatabase, T extends RagableTableNames<D>> = [keyof D["public"]["Tables"]] extends [never] ? Record<string, unknown> : T extends keyof D["public"]["Tables"] ? TablesInsert<D, T> : Record<string, unknown>;
67
67
  /** Update patch for typed `from(table).update(...)`. */
68
68
  type TableUpdatePatch<D extends RagableDatabase, T extends RagableTableNames<D>> = [keyof D["public"]["Tables"]] extends [never] ? Record<string, unknown> : T extends keyof D["public"]["Tables"] ? TablesUpdate<D, T> : Record<string, unknown>;
69
+ /** Column name union for a given table (keys of `Row`). Falls back to `string` when untyped. */
70
+ type ColumnName<D extends RagableDatabase, T extends RagableTableNames<D>> = [keyof D["public"]["Tables"]] extends [never] ? string : T extends keyof D["public"]["Tables"] ? Extract<keyof TableRow<D, T>, string> : string;
71
+ /** Value type for a specific column. Falls back to `unknown` when untyped. */
72
+ type ColumnValue<D extends RagableDatabase, T extends RagableTableNames<D>, C extends ColumnName<D, T>> = [keyof D["public"]["Tables"]] extends [never] ? unknown : T extends keyof D["public"]["Tables"] ? C extends keyof TableRow<D, T> ? TableRow<D, T>[C] : unknown : unknown;
69
73
 
70
74
  /**
71
75
  * Native `fetch` must not be called as a detached reference (`const f = fetch; f(url)`),
@@ -83,10 +87,35 @@ interface RagableClientOptions {
83
87
  type RequestOptions = Omit<RequestInit, "body"> & {
84
88
  body?: unknown;
85
89
  };
86
- declare class RagableError extends Error {
90
+ declare abstract class RagableSdkError extends Error {
91
+ abstract readonly __type: string;
92
+ constructor(message: string);
93
+ toJSON(): Record<string, unknown>;
94
+ }
95
+ declare class RagableError extends RagableSdkError {
96
+ readonly __type: "RagableError";
87
97
  readonly status: number;
88
98
  readonly body: unknown;
99
+ readonly code: string | undefined;
100
+ readonly details: string | undefined;
89
101
  constructor(message: string, status: number, body: unknown);
102
+ toJSON(): Record<string, unknown>;
103
+ }
104
+ declare class RagableNetworkError extends RagableSdkError {
105
+ readonly __type: "RagableNetworkError";
106
+ readonly cause: unknown;
107
+ constructor(message: string, cause?: unknown);
108
+ toJSON(): Record<string, unknown>;
109
+ }
110
+ declare class RagableAbortError extends RagableSdkError {
111
+ readonly __type: "RagableAbortError";
112
+ constructor(message?: string);
113
+ }
114
+ declare class RagableTimeoutError extends RagableSdkError {
115
+ readonly __type: "RagableTimeoutError";
116
+ readonly timeoutMs: number;
117
+ constructor(timeoutMs: number);
118
+ toJSON(): Record<string, unknown>;
90
119
  }
91
120
  declare function extractErrorMessage(payload: unknown, fallback: string): string;
92
121
  declare class RagableRequestClient {
@@ -242,7 +271,7 @@ declare class AgentsClient {
242
271
  chatStream(agentId: string, params: AgentChatParams): AsyncGenerator<AgentStreamEvent, void, undefined>;
243
272
  }
244
273
 
245
- /** Shared with {@link RagableBrowserDatabaseClient.query} duplicated to avoid circular imports. */
274
+ /** @deprecated Kept for backward compat with `database.query()`. Not used by PostgREST path. */
246
275
  interface BrowserSqlExecParams {
247
276
  databaseInstanceId: string;
248
277
  sql: string;
@@ -251,18 +280,26 @@ interface BrowserSqlExecParams {
251
280
  timeoutMs?: number;
252
281
  rowLimit?: number;
253
282
  }
283
+ /** @deprecated Kept for backward compat with `database.query()`. Not used by PostgREST path. */
254
284
  interface BrowserSqlExecResult<Row extends Record<string, unknown> = Record<string, unknown>> {
255
285
  command: string;
256
286
  rowCount: number;
257
287
  truncated: boolean;
258
288
  rows: Row[];
259
289
  }
260
- type FilterOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "ilike";
261
- interface Filter {
262
- op: FilterOp;
263
- column: string;
264
- value: unknown;
290
+ /** @deprecated Use PostgRESTFetch instead. Kept for `database.query()` backward compat. */
291
+ type RunQuery = <R extends Record<string, unknown> = Record<string, unknown>>(p: BrowserSqlExecParams) => Promise<BrowserSqlExecResult<R>>;
292
+ interface PostgRESTFetchParams {
293
+ method: "GET" | "POST" | "PATCH" | "DELETE";
294
+ table: string;
295
+ searchParams: URLSearchParams;
296
+ body?: unknown;
297
+ headers?: Record<string, string>;
298
+ databaseInstanceId: string;
299
+ signal?: AbortSignal;
300
+ idempotencyKey?: string;
265
301
  }
302
+ type PostgRESTFetch = (params: PostgRESTFetchParams) => Promise<Response>;
266
303
  type PostgrestResult<T> = {
267
304
  data: T;
268
305
  error: null;
@@ -270,161 +307,167 @@ type PostgrestResult<T> = {
270
307
  data: null;
271
308
  error: RagableError;
272
309
  };
273
- /** Map async throws to `{ data, error }` like Supabase JS client. */
274
310
  declare function asPostgrestResponse<T>(fn: () => Promise<T>): Promise<PostgrestResult<T>>;
275
- type RunQuery = <R extends Record<string, unknown> = Record<string, unknown>>(p: BrowserSqlExecParams) => Promise<BrowserSqlExecResult<R>>;
276
- /** Supabase/PostgREST-style read builder: `.from('t').select().eq().single()` */
277
- declare class PostgrestSelectBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
278
- private readonly run;
311
+ type FilterOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "ilike" | "is" | "in";
312
+ interface Filter {
313
+ op: FilterOp;
314
+ column: string;
315
+ value: unknown;
316
+ }
317
+ declare class PostgrestSelectBuilder<Row extends Record<string, unknown> = Record<string, unknown>, D extends RagableDatabase = DefaultRagableDatabase, T extends RagableTableNames<D> = RagableTableNames<D>> implements PromiseLike<PostgrestResult<Row[]>> {
318
+ private readonly pgFetch;
279
319
  private readonly databaseInstanceId;
280
320
  private readonly table;
281
321
  private readonly columns;
282
- private filters;
322
+ filters: Filter[];
283
323
  private _limit?;
324
+ private _offset?;
284
325
  private _order?;
285
- constructor(run: RunQuery, databaseInstanceId: string, table: string, columns: string);
286
- eq(column: string, value: unknown): this;
287
- neq(column: string, value: unknown): this;
288
- gt(column: string, value: unknown): this;
289
- gte(column: string, value: unknown): this;
290
- lt(column: string, value: unknown): this;
291
- lte(column: string, value: unknown): this;
292
- like(column: string, value: unknown): this;
293
- ilike(column: string, value: unknown): this;
326
+ private _signal?;
327
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string, columns: string);
328
+ eq<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
329
+ neq<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
330
+ gt<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
331
+ gte<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
332
+ lt<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
333
+ lte<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
334
+ like<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
335
+ ilike<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
336
+ is<C extends ColumnName<D, T>>(column: C, value: null | boolean): this;
337
+ in<C extends ColumnName<D, T>>(column: C, values: ColumnValue<D, T, C>[]): this;
338
+ match(query: Partial<TableRow<D, T>>): this;
294
339
  limit(n: number): this;
295
- order(column: string, options?: {
340
+ offset(n: number): this;
341
+ range(from: number, to: number): this;
342
+ order(column: ColumnName<D, T>, options?: {
296
343
  ascending?: boolean;
344
+ nullsFirst?: boolean;
297
345
  }): this;
298
- private buildSelectCore;
346
+ abortSignal(signal: AbortSignal): this;
347
+ private buildSearchParams;
299
348
  then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
300
349
  private executeMany;
301
350
  single(): Promise<PostgrestResult<Row>>;
302
351
  maybeSingle(): Promise<PostgrestResult<Row | null>>;
303
352
  }
304
- /** After `.insert()`: await without `.select()` → `{ data: null }` (Supabase default). */
305
353
  declare class PostgrestInsertRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
306
- private readonly run;
354
+ private readonly pgFetch;
307
355
  private readonly databaseInstanceId;
308
356
  private readonly table;
309
357
  private readonly rows;
310
- constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[]);
311
- /**
312
- * Return inserted rows (Supabase: chain `.select()` to get data).
313
- * @see https://supabase.com/docs/reference/javascript/insert
314
- */
358
+ private _signal?;
359
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string, rows: Record<string, unknown>[]);
315
360
  select(columns?: string): PostgrestInsertReturningBuilder<Row>;
361
+ abortSignal(signal: AbortSignal): this;
316
362
  then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
317
363
  private executeNoReturn;
318
364
  }
319
365
  declare class PostgrestInsertReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
320
- private readonly run;
366
+ private readonly pgFetch;
321
367
  private readonly databaseInstanceId;
322
368
  private readonly table;
323
369
  private readonly rows;
324
370
  private readonly returning;
325
- constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], returning: string);
371
+ private readonly _signal?;
372
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], returning: string, _signal?: AbortSignal | undefined);
326
373
  then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
327
374
  private executeMany;
328
375
  single(): Promise<PostgrestResult<Row>>;
329
376
  maybeSingle(): Promise<PostgrestResult<Row | null>>;
330
377
  }
331
- /** Update without `.select()` `{ data: null }` on success. */
332
- declare class PostgrestUpdateRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
333
- private readonly run;
378
+ declare class PostgrestUpdateRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>, D extends RagableDatabase = DefaultRagableDatabase, T extends RagableTableNames<D> = RagableTableNames<D>> implements PromiseLike<PostgrestResult<null>> {
379
+ private readonly pgFetch;
334
380
  private readonly databaseInstanceId;
335
381
  private readonly table;
336
382
  private readonly patch;
337
- private filters;
338
- constructor(run: RunQuery, databaseInstanceId: string, table: string, patch: Record<string, unknown>);
339
- eq(column: string, value: unknown): this;
340
- neq(column: string, value: unknown): this;
341
- gt(column: string, value: unknown): this;
342
- gte(column: string, value: unknown): this;
343
- lt(column: string, value: unknown): this;
344
- lte(column: string, value: unknown): this;
345
- like(column: string, value: unknown): this;
346
- ilike(column: string, value: unknown): this;
347
- /**
348
- * Return updated rows (Supabase: `.update().eq().select()`).
349
- * @see https://supabase.com/docs/reference/javascript/update
350
- */
383
+ filters: Filter[];
384
+ private _signal?;
385
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string, patch: Record<string, unknown>);
386
+ eq<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
387
+ neq<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
388
+ gt<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
389
+ gte<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
390
+ lt<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
391
+ lte<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
392
+ like<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
393
+ ilike<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
394
+ is<C extends ColumnName<D, T>>(column: C, value: null | boolean): this;
395
+ in<C extends ColumnName<D, T>>(column: C, values: ColumnValue<D, T, C>[]): this;
396
+ match(query: Partial<TableRow<D, T>>): this;
351
397
  select(columns?: string): PostgrestUpdateReturningBuilder<Row>;
398
+ abortSignal(signal: AbortSignal): this;
352
399
  then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
400
+ private buildSearchParams;
353
401
  private executeNoReturn;
354
402
  }
355
403
  declare class PostgrestUpdateReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
356
- private readonly run;
404
+ private readonly pgFetch;
357
405
  private readonly databaseInstanceId;
358
406
  private readonly table;
359
407
  private readonly patch;
360
408
  private readonly filters;
361
409
  private readonly returning;
362
- constructor(run: RunQuery, databaseInstanceId: string, table: string, patch: Record<string, unknown>, filters: Filter[], returning: string);
410
+ private readonly _signal?;
411
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string, patch: Record<string, unknown>, filters: Filter[], returning: string, _signal?: AbortSignal | undefined);
363
412
  then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
364
413
  private executeMany;
365
414
  single(): Promise<PostgrestResult<Row>>;
366
415
  maybeSingle(): Promise<PostgrestResult<Row | null>>;
367
416
  }
368
- /** Delete without `.select()` `{ data: null }`. */
369
- declare class PostgrestDeleteRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
370
- private readonly run;
417
+ declare class PostgrestDeleteRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>, D extends RagableDatabase = DefaultRagableDatabase, T extends RagableTableNames<D> = RagableTableNames<D>> implements PromiseLike<PostgrestResult<null>> {
418
+ private readonly pgFetch;
371
419
  private readonly databaseInstanceId;
372
420
  private readonly table;
373
- private filters;
374
- constructor(run: RunQuery, databaseInstanceId: string, table: string);
375
- eq(column: string, value: unknown): this;
376
- neq(column: string, value: unknown): this;
377
- gt(column: string, value: unknown): this;
378
- gte(column: string, value: unknown): this;
379
- lt(column: string, value: unknown): this;
380
- lte(column: string, value: unknown): this;
381
- like(column: string, value: unknown): this;
382
- ilike(column: string, value: unknown): this;
383
- /**
384
- * Return deleted rows (Supabase: `.delete().eq().select()`).
385
- * @see https://supabase.com/docs/reference/javascript/delete
386
- */
421
+ filters: Filter[];
422
+ private _signal?;
423
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string);
424
+ eq<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
425
+ neq<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
426
+ gt<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
427
+ gte<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
428
+ lt<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
429
+ lte<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
430
+ like<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
431
+ ilike<C extends ColumnName<D, T>>(column: C, value: ColumnValue<D, T, C>): this;
432
+ is<C extends ColumnName<D, T>>(column: C, value: null | boolean): this;
433
+ in<C extends ColumnName<D, T>>(column: C, values: ColumnValue<D, T, C>[]): this;
434
+ match(query: Partial<TableRow<D, T>>): this;
387
435
  select(columns?: string): PostgrestDeleteReturningBuilder<Row>;
436
+ abortSignal(signal: AbortSignal): this;
388
437
  then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
389
438
  private executeNoReturn;
390
439
  }
391
440
  declare class PostgrestDeleteReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
392
- private readonly run;
441
+ private readonly pgFetch;
393
442
  private readonly databaseInstanceId;
394
443
  private readonly table;
395
444
  private readonly filters;
396
445
  private readonly returning;
397
- constructor(run: RunQuery, databaseInstanceId: string, table: string, filters: Filter[], returning: string);
446
+ private readonly _signal?;
447
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string, filters: Filter[], returning: string, _signal?: AbortSignal | undefined);
398
448
  then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
399
449
  private executeMany;
400
450
  single(): Promise<PostgrestResult<Row>>;
401
451
  maybeSingle(): Promise<PostgrestResult<Row | null>>;
402
452
  }
403
453
  interface PostgrestUpsertOptions {
404
- /** Column(s) for `ON CONFLICT` — single name or comma-separated, e.g. `"id"` or `"org_id,user_id"`. */
405
454
  onConflict: string;
406
- /** When true, `ON CONFLICT DO NOTHING` (no update of existing rows). */
407
455
  ignoreDuplicates?: boolean;
408
456
  }
409
- /** Upsert without `.select()` → `{ data: null }`. */
410
457
  declare class PostgrestUpsertRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
411
- private readonly run;
458
+ private readonly pgFetch;
412
459
  private readonly databaseInstanceId;
413
460
  private readonly table;
414
461
  private readonly rows;
462
+ private readonly onConflict;
415
463
  private readonly ignoreDuplicates;
416
- private readonly conflictCols;
417
- constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], onConflict: string, ignoreDuplicates: boolean);
418
- /**
419
- * Return upserted rows (Supabase: `.upsert().select()`).
420
- * @see https://supabase.com/docs/reference/javascript/upsert
421
- */
464
+ private _signal?;
465
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], onConflict: string, ignoreDuplicates: boolean);
422
466
  select(columns?: string): PostgrestUpsertReturningBuilder<Row>;
467
+ abortSignal(signal: AbortSignal): this;
423
468
  then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
424
469
  private executeNoReturn;
425
- private runUpsert;
426
- /** Used by returning builder */
427
- runWithReturning(returning: string): Promise<BrowserSqlExecResult<Row>>;
470
+ runUpsert(prefer: string, selectCols: string | null): Promise<Row[]>;
428
471
  }
429
472
  declare class PostgrestUpsertReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
430
473
  private readonly root;
@@ -436,67 +479,282 @@ declare class PostgrestUpsertReturningBuilder<Row extends Record<string, unknown
436
479
  maybeSingle(): Promise<PostgrestResult<Row | null>>;
437
480
  }
438
481
  declare class PostgrestTableApi<Database extends RagableDatabase = DefaultRagableDatabase, TableName extends RagableTableNames<Database> = RagableTableNames<Database>> {
439
- private readonly run;
482
+ private readonly pgFetch;
440
483
  private readonly databaseInstanceId;
441
484
  private readonly table;
442
- constructor(run: RunQuery, databaseInstanceId: string, table: TableName extends string ? string : string);
443
- select(columns?: string): PostgrestSelectBuilder<TableRow<Database, TableName>>;
485
+ constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: TableName extends string ? string : string);
486
+ select(columns?: string): PostgrestSelectBuilder<TableRow<Database, TableName>, Database, TableName>;
444
487
  insert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[]): PostgrestInsertRootBuilder<TableRow<Database, TableName>>;
445
- update(patch: TableUpdatePatch<Database, TableName>): PostgrestUpdateRootBuilder<TableRow<Database, TableName>>;
446
- delete(): PostgrestDeleteRootBuilder<TableRow<Database, TableName>>;
447
- /**
448
- * `INSERT ... ON CONFLICT ... DO UPDATE` (or `DO NOTHING` with `ignoreDuplicates`).
449
- * @see https://supabase.com/docs/reference/javascript/upsert
450
- */
488
+ update(patch: TableUpdatePatch<Database, TableName>): PostgrestUpdateRootBuilder<TableRow<Database, TableName>, Database, TableName>;
489
+ delete(): PostgrestDeleteRootBuilder<TableRow<Database, TableName>, Database, TableName>;
451
490
  upsert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[], options: PostgrestUpsertOptions): PostgrestUpsertRootBuilder<TableRow<Database, TableName>>;
452
491
  }
453
492
 
454
- /**
455
- * Ensures the browser SDK hits `/api/...` routes. Accepts either `https://host` or `https://host/api`
456
- * (same rule as two-arg `createClient(url, opts)` from the package entry).
457
- */
493
+ interface SessionStorage {
494
+ getItem(key: string): string | null | Promise<string | null>;
495
+ setItem(key: string, value: string): void | Promise<void>;
496
+ removeItem(key: string): void | Promise<void>;
497
+ }
498
+ declare class LocalStorageAdapter implements SessionStorage {
499
+ getItem(key: string): string | null;
500
+ setItem(key: string, value: string): void;
501
+ removeItem(key: string): void;
502
+ }
503
+ declare class SessionStorageAdapter implements SessionStorage {
504
+ getItem(key: string): string | null;
505
+ setItem(key: string, value: string): void;
506
+ removeItem(key: string): void;
507
+ }
508
+ declare class MemoryStorageAdapter implements SessionStorage {
509
+ private store;
510
+ getItem(key: string): string | null;
511
+ setItem(key: string, value: string): void;
512
+ removeItem(key: string): void;
513
+ }
514
+ declare class CookieStorageAdapter implements SessionStorage {
515
+ private readonly maxAge;
516
+ private readonly path;
517
+ private readonly sameSite;
518
+ constructor(maxAge?: number, path?: string, sameSite?: "Lax" | "Strict" | "None");
519
+ getItem(key: string): string | null;
520
+ setItem(key: string, value: string): void;
521
+ removeItem(key: string): void;
522
+ }
523
+ declare function detectStorage(): SessionStorage;
524
+ type AuthBroadcastMessage = {
525
+ type: "SESSION_UPDATED";
526
+ payload: string;
527
+ } | {
528
+ type: "SESSION_REMOVED";
529
+ };
530
+ declare class AuthBroadcastChannel {
531
+ private channel;
532
+ constructor(channelName: string);
533
+ onMessage(cb: (msg: AuthBroadcastMessage) => void): void;
534
+ postSessionUpdated(serialized: string): void;
535
+ postSessionRemoved(): void;
536
+ close(): void;
537
+ }
538
+
539
+ type AuthChangeEvent = "INITIAL_SESSION" | "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED";
540
+ interface AuthSession<U extends Record<string, unknown> = Record<string, unknown>> {
541
+ access_token: string;
542
+ refresh_token: string;
543
+ expires_in: number;
544
+ expires_at: number;
545
+ token_type: "bearer";
546
+ user: U;
547
+ }
548
+ interface AuthOptions {
549
+ persistSession?: boolean;
550
+ autoRefreshToken?: boolean;
551
+ storage?: SessionStorage;
552
+ storageKey?: string;
553
+ refreshSkewSeconds?: number;
554
+ debug?: boolean;
555
+ }
556
+ interface RagableAuthConfig {
557
+ baseUrl: string;
558
+ authGroupId: string;
559
+ fetch?: typeof fetch;
560
+ headers?: HeadersInit;
561
+ auth?: AuthOptions;
562
+ }
563
+ type AuthListener<U extends Record<string, unknown>> = (event: AuthChangeEvent, session: AuthSession<U> | null) => void;
564
+ interface Subscription {
565
+ id: string;
566
+ unsubscribe: () => void;
567
+ }
568
+ declare class RagableAuth<U extends Record<string, unknown> = Record<string, unknown>> {
569
+ private readonly fetchImpl;
570
+ private readonly baseUrl;
571
+ private readonly authGroupId;
572
+ private readonly defaultHeaders;
573
+ private readonly persistSession;
574
+ private readonly autoRefreshToken;
575
+ private readonly storage;
576
+ private readonly storageKey;
577
+ private readonly refreshSkewSeconds;
578
+ private readonly debug;
579
+ private currentSession;
580
+ private refreshTimer;
581
+ private refreshPromise;
582
+ private listeners;
583
+ private broadcast;
584
+ private visibilityHandler;
585
+ private initialized;
586
+ constructor(config: RagableAuthConfig);
587
+ private log;
588
+ initialize(): Promise<AuthSession<U> | null>;
589
+ signUp(credentials: {
590
+ email: string;
591
+ password: string;
592
+ options?: {
593
+ data?: Record<string, unknown>;
594
+ };
595
+ }): Promise<PostgrestResult<{
596
+ user: U;
597
+ session: AuthSession<U>;
598
+ }>>;
599
+ signInWithPassword(credentials: {
600
+ email: string;
601
+ password: string;
602
+ }): Promise<PostgrestResult<{
603
+ user: U;
604
+ session: AuthSession<U>;
605
+ }>>;
606
+ signOut(_options?: {
607
+ scope?: "global" | "local";
608
+ }): Promise<{
609
+ error: null;
610
+ }>;
611
+ refreshSession(refreshToken?: string): Promise<PostgrestResult<{
612
+ session: AuthSession<U>;
613
+ user: U;
614
+ }>>;
615
+ getSession(): Promise<PostgrestResult<{
616
+ session: AuthSession<U> | null;
617
+ }>>;
618
+ getUser(): Promise<PostgrestResult<{
619
+ user: U;
620
+ }>>;
621
+ setSession(tokens: {
622
+ access_token: string;
623
+ refresh_token: string;
624
+ }): Promise<PostgrestResult<{
625
+ session: AuthSession<U>;
626
+ user: U;
627
+ }>>;
628
+ updateUser(attributes: {
629
+ email?: string;
630
+ password?: string;
631
+ data?: {
632
+ name?: string | null;
633
+ };
634
+ }): Promise<PostgrestResult<{
635
+ user: U;
636
+ }>>;
637
+ onAuthStateChange(callback: AuthListener<U>): {
638
+ data: {
639
+ subscription: Subscription;
640
+ };
641
+ };
642
+ getAccessToken(): string | null;
643
+ getCurrentSession(): AuthSession<U> | null;
644
+ register(body: {
645
+ email: string;
646
+ password: string;
647
+ name?: string;
648
+ }): Promise<{
649
+ user: U;
650
+ accessToken: string;
651
+ refreshToken: string;
652
+ expiresIn: string;
653
+ }>;
654
+ login(body: {
655
+ email: string;
656
+ password: string;
657
+ }): Promise<{
658
+ user: U;
659
+ accessToken: string;
660
+ refreshToken: string;
661
+ expiresIn: string;
662
+ }>;
663
+ refresh(body: {
664
+ refreshToken: string;
665
+ }): Promise<{
666
+ accessToken: string;
667
+ refreshToken: string;
668
+ expiresIn: string;
669
+ }>;
670
+ getMe(): Promise<{
671
+ user: U;
672
+ }>;
673
+ updateMe(body: {
674
+ name?: string | null;
675
+ password?: string;
676
+ }): Promise<{
677
+ user: U;
678
+ }>;
679
+ destroy(): void;
680
+ private authPrefix;
681
+ private toUrl;
682
+ private baseHeaders;
683
+ private fetchAuth;
684
+ private fetchAuthWithBearer;
685
+ private rawToSession;
686
+ private setSessionInternal;
687
+ private persistCurrentSession;
688
+ private emit;
689
+ private scheduleRefresh;
690
+ private clearRefreshTimer;
691
+ singleFlightRefresh(refreshToken: string): Promise<AuthSession<U> | null>;
692
+ private _doRefresh;
693
+ private setupVisibilityListener;
694
+ }
695
+
696
+ type HttpMethod = "GET" | "POST" | "PATCH" | "PUT" | "DELETE" | "HEAD";
697
+ interface RetryOptions {
698
+ maxRetries: number;
699
+ baseDelayMs: number;
700
+ maxDelayMs: number;
701
+ retryOn: number[];
702
+ respectRetryAfter: boolean;
703
+ }
704
+ interface TransportOptions {
705
+ fetch?: typeof fetch;
706
+ headers?: HeadersInit;
707
+ retry?: Partial<RetryOptions>;
708
+ timeoutMs?: number;
709
+ onRequest?: (req: TransportRequest) => void;
710
+ onResponse?: (req: TransportRequest, res: Response, durationMs: number) => void;
711
+ onRetry?: (req: TransportRequest, attempt: number, delayMs: number, reason: string) => void;
712
+ }
713
+ interface TransportRequest {
714
+ url: string;
715
+ method: HttpMethod;
716
+ headers: Headers;
717
+ body?: BodyInit;
718
+ signal?: AbortSignal;
719
+ idempotencyKey?: string;
720
+ retry?: Partial<RetryOptions>;
721
+ timeoutMs?: number;
722
+ }
723
+ declare function generateIdempotencyKey(): string;
724
+ declare class Transport {
725
+ private readonly fetchImpl;
726
+ private readonly defaultHeaders;
727
+ private readonly defaultRetry;
728
+ private readonly defaultTimeoutMs;
729
+ private readonly onRequest?;
730
+ private readonly onResponse?;
731
+ private readonly onRetry?;
732
+ private readonly inflightGets;
733
+ private _refreshHandler;
734
+ constructor(options?: TransportOptions);
735
+ setRefreshHandler(handler: (() => Promise<string | null>) | null): void;
736
+ execute(req: TransportRequest): Promise<Response>;
737
+ private _executeWithRetry;
738
+ private _singleFetch;
739
+ }
740
+ declare function parseTransportResponse<T>(response: Response): Promise<T>;
741
+
458
742
  declare function normalizeBrowserApiBase(baseUrl?: string): string;
459
- /** How {@link RagableBrowserDatabaseClient.query} and `.from()` send `Authorization`. */
460
743
  type BrowserDataAuthMode = "user" | "publicAnon" | "admin";
461
744
  interface RagableBrowserClientOptions {
462
- /** Organization id (UUID) — public agent chat URLs. */
463
745
  organizationId: string;
464
- /**
465
- * Authentication group id when using {@link RagableBrowserAuthClient} or
466
- * {@link RagableBrowserDatabaseClient}.
467
- */
468
746
  authGroupId?: string;
469
- /**
470
- * Default Backspace SQL instance id for {@link RagableBrowser.from} (Supabase-style table API).
471
- */
472
747
  databaseInstanceId?: string;
473
- /**
474
- * Database SQL auth. Default `user`: Bearer = JWT from {@link getAccessToken}.
475
- * `publicAnon`: Bearer = public anon key (read-only SQL only). `admin`: Bearer = data admin key
476
- * (same SQL rules as a logged-in user; **never** expose in browser bundles).
477
- */
478
748
  dataAuth?: BrowserDataAuthMode;
479
- /**
480
- * Static key when {@link dataAuth} is `publicAnon` or `admin` (e.g. `import.meta.env.VITE_…`).
481
- * Ignored when {@link getDataStaticKey} returns a non-empty string.
482
- */
483
749
  dataStaticKey?: string;
484
- /** Load anon/admin key at runtime; wins over {@link dataStaticKey} when non-empty. */
485
750
  getDataStaticKey?: () => string | null | Promise<string | null>;
486
- /**
487
- * Returns the end-user access JWT (from login/register/refresh).
488
- * Required for `auth.getMe`, `auth.updateMe`, and for `database.query` when {@link dataAuth} is `user` (default).
489
- */
490
751
  getAccessToken?: () => string | null | Promise<string | null>;
491
- /**
492
- * API base URL including `/api`, e.g. `https://api.example.com/api`.
493
- * @default `https://ragable-341305259977.asia-southeast1.run.app/api` ({@link DEFAULT_RAGABLE_API_BASE})
494
- */
495
752
  baseUrl?: string;
496
753
  fetch?: typeof fetch;
497
754
  headers?: HeadersInit;
755
+ auth?: AuthOptions;
756
+ transport?: Partial<TransportOptions>;
498
757
  }
499
- /** Successful register/login response (typed `user` via `AuthUser` generic). */
500
758
  interface BrowserAuthSession<AuthUser extends Record<string, unknown> = Record<string, unknown>> {
501
759
  user: AuthUser;
502
760
  accessToken: string;
@@ -508,25 +766,18 @@ interface BrowserAuthTokens {
508
766
  refreshToken: string;
509
767
  expiresIn: string;
510
768
  }
511
- /** Supabase-compatible session shape (snake_case tokens). */
512
769
  interface SupabaseCompatSession<AuthUser extends Record<string, unknown> = Record<string, unknown>> {
513
770
  access_token: string;
514
771
  refresh_token: string;
515
- /** Best-effort seconds from Ragable `expiresIn` (e.g. `7d`, `3600`). */
516
772
  expires_in: number;
517
773
  token_type: "bearer";
518
774
  user: AuthUser;
519
775
  }
520
776
 
521
- /** End-user auth — Ragable names + Supabase/Firebase-style aliases returning `{ data, error }`. */
522
777
  declare class RagableBrowserAuthClient<AuthUser extends Record<string, unknown> = Record<string, unknown>> {
523
- private readonly options;
524
- private readonly fetchImpl;
525
- constructor(options: RagableBrowserClientOptions);
526
- private toUrl;
527
- private baseHeaders;
528
- private authPrefix;
529
- /** Supabase: `signUp` → `{ data: { user, session }, error }` */
778
+ private readonly ragableAuth;
779
+ constructor(_options: RagableBrowserClientOptions, ragableAuth?: RagableAuth<AuthUser> | null);
780
+ private get auth();
530
781
  signUp(credentials: {
531
782
  email: string;
532
783
  password: string;
@@ -537,7 +788,6 @@ declare class RagableBrowserAuthClient<AuthUser extends Record<string, unknown>
537
788
  user: AuthUser;
538
789
  session: SupabaseCompatSession<AuthUser>;
539
790
  }>>;
540
- /** Supabase: `signInWithPassword` */
541
791
  signInWithPassword(credentials: {
542
792
  email: string;
543
793
  password: string;
@@ -545,16 +795,13 @@ declare class RagableBrowserAuthClient<AuthUser extends Record<string, unknown>
545
795
  user: AuthUser;
546
796
  session: SupabaseCompatSession<AuthUser>;
547
797
  }>>;
548
- /** Supabase: `refreshSession` */
549
798
  refreshSession(refreshToken: string): Promise<PostgrestResult<{
550
799
  session: SupabaseCompatSession<AuthUser>;
551
800
  user: AuthUser;
552
801
  }>>;
553
- /** Supabase: `getUser()` — needs `getAccessToken` on the client */
554
802
  getUser(): Promise<PostgrestResult<{
555
803
  user: AuthUser;
556
804
  }>>;
557
- /** Supabase: `updateUser` */
558
805
  updateUser(attributes: {
559
806
  email?: string;
560
807
  password?: string;
@@ -564,16 +811,11 @@ declare class RagableBrowserAuthClient<AuthUser extends Record<string, unknown>
564
811
  }): Promise<PostgrestResult<{
565
812
  user: AuthUser;
566
813
  }>>;
567
- /**
568
- * Supabase/Firebase: no server call — clear tokens in your app.
569
- * Returns `{ error: null }` for API compatibility.
570
- */
571
814
  signOut(_options?: {
572
815
  scope?: "global" | "local";
573
816
  }): Promise<{
574
817
  error: null;
575
818
  }>;
576
- private getUserFromToken;
577
819
  register(body: {
578
820
  email: string;
579
821
  password: string;
@@ -595,19 +837,22 @@ declare class RagableBrowserAuthClient<AuthUser extends Record<string, unknown>
595
837
  }): Promise<{
596
838
  user: AuthUser;
597
839
  }>;
840
+ onAuthStateChange(callback: (event: AuthChangeEvent, session: AuthSession<AuthUser> | null) => void): {
841
+ data: {
842
+ subscription: {
843
+ id: string;
844
+ unsubscribe: () => void;
845
+ };
846
+ };
847
+ };
848
+ getSession(): Promise<PostgrestResult<{
849
+ session: AuthSession<AuthUser> | null;
850
+ }>>;
598
851
  }
599
852
  interface BrowserSqlQueryParams {
600
- /**
601
- * Defaults to `databaseInstanceId` on {@link RagableBrowserClientOptions} when set
602
- * (so you can configure it once on `createBrowserClient`).
603
- */
604
853
  databaseInstanceId?: string;
605
854
  sql: string;
606
855
  params?: unknown[];
607
- /**
608
- * Default `true`. When `false`, the API allows INSERT/UPDATE/DELETE (and existing safe reads);
609
- * DDL (`CREATE`/`DROP`/`ALTER`/…) and privilege changes remain blocked.
610
- */
611
856
  readOnly?: boolean;
612
857
  timeoutMs?: number;
613
858
  rowLimit?: number;
@@ -618,59 +863,38 @@ interface BrowserSqlQueryResult<Row extends Record<string, unknown> = Record<str
618
863
  truncated: boolean;
619
864
  rows: Row[];
620
865
  }
621
- /**
622
- * Raw SQL against linked Postgres (escape hatch). Prefer {@link RagableBrowser.from} for
623
- * Supabase-style `.select()` / `.insert()` / `.update()` / `.delete()`.
624
- */
625
866
  declare class RagableBrowserDatabaseClient<_Schema extends RagableDatabase = DefaultRagableDatabase> {
626
867
  private readonly options;
868
+ private readonly ragableAuth;
627
869
  private readonly fetchImpl;
628
- constructor(options: RagableBrowserClientOptions);
870
+ constructor(options: RagableBrowserClientOptions, ragableAuth?: RagableAuth | null);
629
871
  private toUrl;
630
872
  query<Row extends Record<string, unknown> = Record<string, unknown>>(params: BrowserSqlQueryParams): Promise<BrowserSqlQueryResult<Row>>;
631
873
  private baseHeaders;
632
874
  }
633
- /**
634
- * Browser-safe client: **no org API key**. Uses public routes and end-user JWTs
635
- * from {@link RagableBrowserAuthClient}.
636
- */
637
875
  declare class RagableBrowserAgentsClient {
638
876
  private readonly options;
639
877
  private readonly fetchImpl;
640
878
  constructor(options: RagableBrowserClientOptions);
641
879
  private toUrl;
642
- /**
643
- * Stream agent execution as SSE (`POST /public/organizations/:orgId/agents/:agentId/chat/stream`).
644
- */
645
880
  chatStream(agentId: string, params: AgentPublicChatParams): AsyncGenerator<AgentStreamEvent, void, undefined>;
646
881
  }
647
- /** Public chat params — same shape as {@link AgentChatParams} plus optional trigger fields. */
648
882
  interface AgentPublicChatParams extends AgentChatParams {
649
883
  triggerSubtype?: string;
650
884
  triggerNodeId?: string;
651
885
  }
652
- /**
653
- * Browser client: mirrors **Supabase JS** (`createClient`, `.from()`, `.auth.signInWithPassword`, `{ data, error }`)
654
- * plus Ragable **`agents.chatStream`**. Server secrets: {@link createRagableServerClient} / {@link createClient} with `apiKey`.
655
- */
656
886
  declare class RagableBrowser<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends Record<string, unknown> = Record<string, unknown>> {
657
887
  readonly agents: RagableBrowserAgentsClient;
658
888
  readonly auth: RagableBrowserAuthClient<AuthUser>;
659
889
  readonly database: RagableBrowserDatabaseClient<Database>;
890
+ readonly transport: Transport;
660
891
  private readonly options;
892
+ private readonly _ragableAuth;
661
893
  constructor(options: RagableBrowserClientOptions);
662
- /**
663
- * Supabase-style table API: `.from('items').select().eq('id', 1).single()`.
664
- * Pass `databaseInstanceId` here or set `databaseInstanceId` on the client options.
665
- */
666
894
  from<TableName extends RagableTableNames<Database>>(table: TableName, databaseInstanceId?: string): PostgrestTableApi<Database, TableName>;
895
+ destroy(): void;
667
896
  }
668
- /**
669
- * **Supabase-equivalent** browser client factory (no org API key).
670
- * Same as {@link createRagableBrowserClient}.
671
- */
672
897
  declare function createBrowserClient<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends Record<string, unknown> = Record<string, unknown>>(options: RagableBrowserClientOptions): RagableBrowser<Database, AuthUser>;
673
- /** Alias for {@link createBrowserClient} — matches Supabase `createClient` naming. */
674
898
  declare const createRagableBrowserClient: typeof createBrowserClient;
675
899
 
676
900
  /**
@@ -744,20 +968,9 @@ declare class Ragable {
744
968
  };
745
969
  constructor(options: RagableClientOptions);
746
970
  }
747
- /**
748
- * **Supabase-style overloads**
749
- * - `createClient(RAGABLE_URL, { organizationId, authGroupId, … })` — browser (no API key)
750
- * - `createClient({ apiKey, baseUrl })` — server / Engine (secret key)
751
- *
752
- * Prefer {@link createRagableServerClient} in backend code if the dual overload is confusing.
753
- */
754
971
  declare function createClient<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends Record<string, unknown> = Record<string, unknown>>(url: string, options: Omit<RagableBrowserClientOptions, "baseUrl">): RagableBrowser<Database, AuthUser>;
755
972
  declare function createClient(options: RagableClientOptions): Ragable;
756
973
  declare function createClient<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends Record<string, unknown> = Record<string, unknown>>(options: RagableBrowserClientOptions): RagableBrowser<Database, AuthUser>;
757
- /**
758
- * Explicit **server** factory — same as `createClient({ apiKey, baseUrl })`.
759
- * Use in the Engine; never import alongside browser `createClient(url, …)` if you want tree-shaking clarity.
760
- */
761
974
  declare function createRagableServerClient(options: RagableClientOptions): Ragable;
762
975
 
763
- export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentPublicChatParams, type AgentStreamEvent, type AgentSummary, AgentsClient, type BrowserAuthSession, type BrowserAuthTokens, type BrowserDataAuthMode, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, DEFAULT_RAGABLE_API_BASE, type DefaultRagableDatabase, type FormatContextOptions, type Json, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, type RagableClientOptions, type RagableDatabase, RagableError, RagableRequestClient, type RagableTableDefinition, type RagableTableNames, type RequestOptions, type RetrieveParams, type RunQuery, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, type SseJsonEvent, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, asPostgrestResponse, bindFetch, createBrowserClient, createClient, createRagPipeline, createRagableBrowserClient, createRagableServerClient, extractErrorMessage, formatRetrievalContext, normalizeBrowserApiBase, parseSseDataLine, readSseStream };
976
+ export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentPublicChatParams, type AgentStreamEvent, type AgentSummary, AgentsClient, AuthBroadcastChannel, type AuthBroadcastMessage, type AuthChangeEvent, type AuthOptions, type AuthSession, type BrowserAuthSession, type BrowserAuthTokens, type BrowserDataAuthMode, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, type ColumnName, type ColumnValue, CookieStorageAdapter, DEFAULT_RAGABLE_API_BASE, type DefaultRagableDatabase, type FormatContextOptions, type HttpMethod, type Json, LocalStorageAdapter, MemoryStorageAdapter, type PostgRESTFetch, type PostgRESTFetchParams, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, RagableAbortError, RagableAuth, type RagableAuthConfig, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, type RagableClientOptions, type RagableDatabase, RagableError, RagableNetworkError, RagableRequestClient, RagableSdkError, type RagableTableDefinition, type RagableTableNames, RagableTimeoutError, type RequestOptions, type RetrieveParams, type RetryOptions, type RunQuery, type SessionStorage, SessionStorageAdapter, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, type SseJsonEvent, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, Transport, type TransportOptions, type TransportRequest, asPostgrestResponse, bindFetch, createBrowserClient, createClient, createRagPipeline, createRagableBrowserClient, createRagableServerClient, detectStorage, extractErrorMessage, formatRetrievalContext, generateIdempotencyKey, normalizeBrowserApiBase, parseSseDataLine, parseTransportResponse, readSseStream };