@ragable/sdk 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -708,7 +708,7 @@ declare class AuthBroadcastChannel {
708
708
  close(): void;
709
709
  }
710
710
 
711
- type AuthChangeEvent = "INITIAL_SESSION" | "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED";
711
+ type AuthChangeEvent = "INITIAL_SESSION" | "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "TOKEN_REFRESH_FAILED" | "USER_UPDATED";
712
712
  type AuthUserMetadata = Record<string, unknown>;
713
713
  interface DefaultAuthUser<Metadata extends AuthUserMetadata = AuthUserMetadata> {
714
714
  id: string;
@@ -783,10 +783,26 @@ declare class RagableAuth<U extends object = DefaultAuthUser> {
783
783
  private listeners;
784
784
  private broadcast;
785
785
  private visibilityHandler;
786
- private initialized;
786
+ /** Memoizes the one-shot restore so concurrent callers (constructor eager init,
787
+ * every `onAuthStateChange` subscriber, `getSession`) share a single result.
788
+ * Non-null also means "restore has started", replacing the old boolean flag. */
789
+ private initializePromise;
790
+ /** Bumped on every explicit session change (sign-in/out, refresh). The async
791
+ * restore captures this and refuses to overwrite a newer session op that
792
+ * landed while it was reading storage (e.g. a sign-out during page load). */
793
+ private sessionEpoch;
787
794
  constructor(config: RagableAuthConfig);
788
795
  private log;
796
+ /**
797
+ * Restore a persisted session (once). Memoized: every caller awaits the same
798
+ * promise, so the eager constructor init, `getSession`, and each
799
+ * `onAuthStateChange` subscriber's INITIAL_SESSION replay never race or
800
+ * double-restore. Does NOT emit `INITIAL_SESSION` globally — that event is
801
+ * delivered per-subscriber by `onAuthStateChange` (Supabase-parity), so a
802
+ * listener attached after restore still sees the existing session.
803
+ */
789
804
  initialize(): Promise<AuthSession<U> | null>;
805
+ private _initialize;
790
806
  signUp(credentials: AuthSignUpCredentials<MetadataForUser<U>>): Promise<PostgrestResult<{
791
807
  user: U;
792
808
  session: AuthSession<U>;
@@ -835,7 +851,14 @@ declare class RagableAuth<U extends object = DefaultAuthUser> {
835
851
  };
836
852
  };
837
853
  getAccessToken(): string | null;
838
- getValidAccessToken(): Promise<string | null>;
854
+ /**
855
+ * Returns an access token guaranteed fresh for at least `refreshSkewSeconds`,
856
+ * refreshing (single-flight) if needed. Pass `force: true` to bypass the skew
857
+ * check and refresh now — used by the transport's 401 handler so a token the
858
+ * server rejected (key rotation, clock skew, early revocation) self-heals on
859
+ * retry instead of failing the call.
860
+ */
861
+ getValidAccessToken(force?: boolean): Promise<string | null>;
839
862
  getCurrentSession(): AuthSession<U> | null;
840
863
  register(body: {
841
864
  email: string;
@@ -891,7 +914,17 @@ declare class RagableAuth<U extends object = DefaultAuthUser> {
891
914
  private emit;
892
915
  private scheduleRefresh;
893
916
  private clearRefreshTimer;
917
+ /**
918
+ * Refresh the session, deduplicating concurrent callers onto one in-flight
919
+ * request. Side effects (persisting the new session, or clearing it and
920
+ * emitting SIGNED_OUT / TOKEN_REFRESH_FAILED) run exactly once inside the
921
+ * shared promise, so two callers can't double-emit. Resolves to the new
922
+ * session, or `null` when the refresh failed.
923
+ */
894
924
  singleFlightRefresh(refreshToken: string): Promise<AuthSession<U> | null>;
925
+ /** Clear the session locally and emit SIGNED_OUT after a definitively-rejected
926
+ * refresh, so onAuthStateChange-driven UI redirects to login. */
927
+ private handleTerminalRefreshFailure;
895
928
  private _doRefresh;
896
929
  private setupVisibilityListener;
897
930
  }
@@ -1246,6 +1279,106 @@ declare function streamObjectFromContext<T = unknown>(ctx: InferenceRequestConte
1246
1279
  */
1247
1280
  declare function wrapStreamTextAsObject<T = unknown>(inner: StreamTextResult): StreamObjectResult<T>;
1248
1281
 
1282
+ /**
1283
+ * Server-side client — the authenticated SDK for code that runs on a trusted
1284
+ * server (a Ragable backend **function**, an Engine, or your own Node service).
1285
+ *
1286
+ * Unlike the browser client there is **no sign-in / session machinery** here:
1287
+ * a server is not a logged-in user. Instead you provide credentials up front and
1288
+ * the client speaks to the same Ragable data plane the browser uses, so the
1289
+ * semantics (collection security, `{ data, error }` shapes, PostgREST) are
1290
+ * identical — this reuses the exact same fetch-based sub-clients, never a
1291
+ * reimplementation.
1292
+ *
1293
+ * Two privilege levels:
1294
+ * - **caller** (default): acts as the end user who invoked you — uses their
1295
+ * forwarded access token, falling back to the public anon key for anonymous
1296
+ * callers. Collection security applies, exactly as in the browser.
1297
+ * - **admin**: authenticates with the auth group's **data-admin key**, which
1298
+ * bypasses collection security (owner/group/claim grants do not apply) and
1299
+ * can write protected collections. Reach for it deliberately.
1300
+ *
1301
+ * ```ts
1302
+ * // inside /functions/<name>.ts — `context.ragable` is a pre-built server client
1303
+ * export default async function createTask(input, context) {
1304
+ * // as the caller (respects collection security):
1305
+ * const { data, error } = await context.ragable.db.collections.tasks.insert(input);
1306
+ * // privileged work (bypasses collection security):
1307
+ * await context.ragable.asAdmin().db.collections.audit_log.insert({ action: "create" });
1308
+ * return data;
1309
+ * }
1310
+ * ```
1311
+ */
1312
+
1313
+ /** Which credential a server client authenticates with. */
1314
+ type ServerPrivilege = "caller" | "admin";
1315
+ /**
1316
+ * Inputs to {@link createServerClient}. The IDs and keys are normally supplied by
1317
+ * the runtime (a function's injected `context.ragable`); construct one by hand
1318
+ * only for a standalone server.
1319
+ */
1320
+ interface RagableServerClientConfig {
1321
+ organizationId: string;
1322
+ websiteId?: string;
1323
+ authGroupId?: string;
1324
+ databaseInstanceId?: string;
1325
+ storageBucketId?: string;
1326
+ mailAccountId?: string;
1327
+ /**
1328
+ * The auth group's **data-admin key**. Required for `admin` privilege; omit it
1329
+ * and `asAdmin()` throws. Server-only — never expose this to the browser.
1330
+ */
1331
+ adminKey?: string;
1332
+ /**
1333
+ * The invoking end user's access token (a real auth-group JWT), forwarded by
1334
+ * the runtime. `null`/omitted for anonymous callers. Used by `caller`
1335
+ * privilege; the public anon key is the fallback when this is absent.
1336
+ */
1337
+ callerToken?: string | null;
1338
+ /** Public anon key — the `caller` fallback when no end user is signed in. */
1339
+ publicAnonKey?: string;
1340
+ /** Default privilege for the returned client. Defaults to `"caller"`. */
1341
+ defaultPrivilege?: ServerPrivilege;
1342
+ fetch?: typeof fetch;
1343
+ headers?: HeadersInit;
1344
+ }
1345
+ /**
1346
+ * A trusted, server-side Ragable client. Surface mirrors the browser client
1347
+ * (`db`, `storage`, `mail`, `functions`, `ai`, `agents`) minus `auth` — a server
1348
+ * authenticates with keys, not a session. Switch privilege with {@link asAdmin}
1349
+ * / {@link asCaller}.
1350
+ */
1351
+ declare class RagableServerClient<Database extends RagableDatabase = DefaultRagableDatabase, Functions extends RagableFunctions = DefaultRagableFunctions> {
1352
+ private readonly config;
1353
+ readonly database: RagableBrowserDatabaseClient<Database>;
1354
+ readonly db: RagableBrowserDatabaseClient<Database>;
1355
+ readonly storage: RagableBrowserStorageClient;
1356
+ readonly mail: RagableBrowserMailClient;
1357
+ readonly functions: FunctionInvoker<Functions>;
1358
+ readonly ai: RagableBrowserAiClient;
1359
+ readonly agents: RagableBrowserAgentsClient;
1360
+ /** Which credential this client is using. */
1361
+ readonly privilege: ServerPrivilege;
1362
+ constructor(config: RagableServerClientConfig, privilege: ServerPrivilege);
1363
+ /**
1364
+ * A client authenticated with the **data-admin key** — bypasses collection
1365
+ * security (owner/group/claim grants do not apply) and can write protected
1366
+ * collections. Throws `SDK_ADMIN_KEY_REQUIRED` when no admin key is configured.
1367
+ */
1368
+ asAdmin(): RagableServerClient<Database, Functions>;
1369
+ /**
1370
+ * A client scoped to the invoking end user's identity (respects collection
1371
+ * security). This is already the default; use it to drop back from `asAdmin()`.
1372
+ */
1373
+ asCaller(): RagableServerClient<Database, Functions>;
1374
+ }
1375
+ /**
1376
+ * Create a server-side Ragable client. Defaults to **caller** privilege (acts as
1377
+ * the invoking end user, respecting collection security); call `.asAdmin()` for
1378
+ * privileged, security-bypassing access.
1379
+ */
1380
+ declare function createServerClient<Database extends RagableDatabase = DefaultRagableDatabase, Functions extends RagableFunctions = DefaultRagableFunctions>(config: RagableServerClientConfig): RagableServerClient<Database, Functions>;
1381
+
1249
1382
  /**
1250
1383
  * Backend "edge functions".
1251
1384
  *
@@ -1274,6 +1407,7 @@ declare function wrapStreamTextAsObject<T = unknown>(inner: StreamTextResult): S
1274
1407
  * The handler's second argument (`context`) is injected by the server; callers
1275
1408
  * pass only `input`.
1276
1409
  */
1410
+
1277
1411
  /**
1278
1412
  * Server-injected second argument to every function handler. Never constructed
1279
1413
  * on the client — the values come from the backend at invocation time.
@@ -1298,6 +1432,16 @@ interface RagableFunctionContext {
1298
1432
  auth: {
1299
1433
  token: string | null;
1300
1434
  };
1435
+ /**
1436
+ * A pre-authenticated {@link RagableServerClient} for talking back to your
1437
+ * Ragable Cloud (db / storage / mail / functions / ai / agents) — already
1438
+ * wired to this project, no setup or keys to manage.
1439
+ *
1440
+ * Defaults to the **caller's** identity, so collection security applies just
1441
+ * like in the browser. Call `context.ragable.asAdmin()` for privileged work
1442
+ * that must bypass collection security (e.g. owner-only writes, audit logs).
1443
+ */
1444
+ ragable: RagableServerClient;
1301
1445
  }
1302
1446
  /**
1303
1447
  * The shape a `/functions/<name>.ts` default export must satisfy. Type the
@@ -1340,13 +1484,23 @@ type FunctionInvoker<F extends RagableFunctions = DefaultRagableFunctions> = {
1340
1484
 
1341
1485
  /** Canonical browser/server API base (`…/api`, no trailing slash). */
1342
1486
  declare function normalizeBrowserApiBase(): string;
1343
- type BrowserDataAuthMode = "user" | "publicAnon" | "admin";
1487
+ type BrowserDataAuthMode = "user" | "publicAnon" | "admin" | "auto";
1344
1488
  /**
1345
- * Resolves how database requests are authorized. If `dataAuth` is omitted and a
1346
- * static browser data key is configured (`dataStaticKey` / `getDataStaticKey`),
1347
- * defaults to **`publicAnon`** so public apps can use shared collections without
1348
- * sign-in. Use explicit **`dataAuth: "user"`** when you need JWT sessions; use
1349
- * **`"admin"`** when the static key is a data-admin key.
1489
+ * Resolves how database / storage requests are authorized.
1490
+ *
1491
+ * Default (when `dataAuth` is omitted):
1492
+ * - **`auto`** when BOTH a static data key AND user auth (an `authGroupId` or a
1493
+ * `getAccessToken` callback) are configured the generated-site case. This is
1494
+ * the Supabase model: send the signed-in user's JWT when a session exists, and
1495
+ * fall back to the public anon key for logged-out visitors. Without this, a
1496
+ * shipped anon key permanently shadows the user session, so owner/group/claim/
1497
+ * authenticated collection grants can never match a signed-in user.
1498
+ * - **`publicAnon`** when only a static key is configured (no auth group) — a
1499
+ * purely public app.
1500
+ * - **`user`** when neither — JWT-only.
1501
+ *
1502
+ * Set `dataAuth` explicitly to override: `"user"` (JWT required), `"publicAnon"`
1503
+ * (anon key only, never upgrade), or `"admin"` (the static key is a data-admin key).
1350
1504
  */
1351
1505
  declare function effectiveDataAuth(options: RagableBrowserClientOptions): BrowserDataAuthMode;
1352
1506
  interface RagableBrowserClientOptions {
@@ -1461,6 +1615,12 @@ declare class RagableBrowserAuthClient<AuthUser extends object = DefaultAuthUser
1461
1615
  getSession(): Promise<PostgrestResult<{
1462
1616
  session: AuthSession<AuthUser> | null;
1463
1617
  }>>;
1618
+ /**
1619
+ * Returns a valid (auto-refreshed) access token for the current session, or
1620
+ * `null` if signed out. The sanctioned way to obtain a token for a hand-rolled
1621
+ * `fetch` to a custom endpoint — never read tokens out of storage yourself.
1622
+ */
1623
+ getValidAccessToken(): Promise<string | null>;
1464
1624
  }
1465
1625
  interface BrowserSqlQueryParams {
1466
1626
  databaseInstanceId?: string;
@@ -1556,6 +1716,15 @@ type CollectionRowWithMeta<Row extends Record<string, unknown> = Record<string,
1556
1716
  };
1557
1717
  declare function collectionRecordToRowWithMeta<Row extends Record<string, unknown>>(record: BrowserCollectionRecord<Row>): CollectionRowWithMeta<Row>;
1558
1718
  declare function collectionRecordsToRowWithMeta<Row extends Record<string, unknown>>(records: BrowserCollectionRecord<Row>[]): CollectionRowWithMeta<Row>[];
1719
+ /**
1720
+ * Rows returned by a find: {@link CollectionRowWithMeta} when the params carry
1721
+ * a literal `return: "flat"`, envelope {@link BrowserCollectionRecord}s
1722
+ * otherwise. Keeps the default (envelope) call sites free of union-narrowing —
1723
+ * `res.data[0].data` typechecks without a cast.
1724
+ */
1725
+ type CollectionFindResult<Row extends Record<string, unknown>, Params> = Params extends {
1726
+ return: "flat";
1727
+ } ? CollectionRowWithMeta<Row>[] : BrowserCollectionRecord<Row>[];
1559
1728
  type BrowserCollectionFindParams<Row extends Record<string, unknown> = Record<string, unknown>> = {
1560
1729
  where?: WhereInput<Row>;
1561
1730
  filters?: Array<{
@@ -1586,11 +1755,11 @@ declare class BrowserCollectionApi<Row extends Record<string, unknown> = Record<
1586
1755
  * Query collection rows. Prefer this over the deprecated `find` alias.
1587
1756
  * Use `return: "flat"` to get {@link CollectionRowWithMeta} without nested `.data`.
1588
1757
  */
1589
- findMany: (whereOrParams?: WhereInput<RowD<Row>> | BrowserCollectionFindParams<RowD<Row>>) => Promise<PostgrestResult<BrowserCollectionRecord<RowD<Row>>[] | CollectionRowWithMeta<RowD<Row>>[]>>;
1758
+ findMany: <Params extends WhereInput<RowD<Row>> | BrowserCollectionFindParams<RowD<Row>>>(whereOrParams?: Params) => Promise<PostgrestResult<CollectionFindResult<RowD<Row>, Params>>>;
1590
1759
  /**
1591
1760
  * @deprecated Use {@link BrowserCollectionApi.findMany} — same behavior.
1592
1761
  */
1593
- find: (whereOrParams?: WhereInput<RowD<Row>> | BrowserCollectionFindParams<RowD<Row>>) => Promise<PostgrestResult<BrowserCollectionRecord<RowD<Row>>[] | CollectionRowWithMeta<RowD<Row>>[]>>;
1762
+ find: <Params extends WhereInput<RowD<Row>> | BrowserCollectionFindParams<RowD<Row>>>(whereOrParams?: Params) => Promise<PostgrestResult<CollectionFindResult<RowD<Row>, Params>>>;
1594
1763
  /**
1595
1764
  * At most one row, `data` is the record or `null` if none match (not an error).
1596
1765
  */
@@ -1811,10 +1980,24 @@ declare class BrowserStorageBucketClient {
1811
1980
  private readonly options;
1812
1981
  private readonly fetchImpl;
1813
1982
  private readonly bucketId;
1814
- constructor(options: RagableBrowserClientOptions, fetchImpl: typeof fetch, bucketId: string);
1983
+ private readonly ragableAuth;
1984
+ constructor(options: RagableBrowserClientOptions, fetchImpl: typeof fetch, bucketId: string, ragableAuth?: RagableAuth | null);
1815
1985
  private get authGroupId();
1816
1986
  private base;
1987
+ /**
1988
+ * Same credential resolution as the database client (see resolveDatabaseAuthBearer):
1989
+ * in the generated-site default (`auto`), a signed-in user's auto-refreshed JWT
1990
+ * is used so storage calls carry the user's identity; logged-out visitors fall
1991
+ * back to the anon key. Previously storage ignored the managed session entirely.
1992
+ */
1817
1993
  private bearerToken;
1994
+ /**
1995
+ * The storage backend has historically returned HTTP 200 with an `{ error }`
1996
+ * body on some failures; without this guard the SDK would resolve those as
1997
+ * successful uploads/deletes. Treat any 2xx whose body carries a non-empty
1998
+ * `error` as a failure.
1999
+ */
2000
+ private assertNoEmbeddedError;
1818
2001
  private req;
1819
2002
  list(params?: {
1820
2003
  prefix?: string;
@@ -1883,7 +2066,8 @@ declare class BrowserStorageBucketClient {
1883
2066
  declare class RagableBrowserStorageClient {
1884
2067
  private readonly options;
1885
2068
  private readonly fetchImpl;
1886
- constructor(options: RagableBrowserClientOptions, fetchImpl: typeof fetch);
2069
+ private readonly ragableAuth;
2070
+ constructor(options: RagableBrowserClientOptions, fetchImpl: typeof fetch, ragableAuth?: RagableAuth | null);
1887
2071
  from(bucketId: string): BrowserStorageBucketClient;
1888
2072
  }
1889
2073
  interface MailSendParams {
@@ -2156,6 +2340,13 @@ declare class RagableBrowser<Database extends RagableDatabase = DefaultRagableDa
2156
2340
  constructor(options: RagableBrowserClientOptions);
2157
2341
  /** Delegates to `database.from()`. Kept for back-compat — prefer `database.from()`. */
2158
2342
  from: <TableName extends RagableTableNames<Database>>(table: TableName, databaseInstanceId?: string) => PostgrestTableApi<Database, TableName>;
2343
+ /**
2344
+ * Resolves once the persisted session has been restored (and refreshed if it
2345
+ * was expired). Await this before reading auth state at startup to avoid a
2346
+ * logged-out flash, e.g. `const session = await client.ready()`. Resolves
2347
+ * `null` when no auth group is configured or no session is stored.
2348
+ */
2349
+ ready(): Promise<AuthSession<AuthUser> | null>;
2159
2350
  destroy(): void;
2160
2351
  }
2161
2352
  declare function createBrowserClient<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends object = DefaultAuthUser, Functions extends RagableFunctions = DefaultRagableFunctions>(options: RagableBrowserClientOptions): RagableBrowser<Database, AuthUser, Functions>;
@@ -2191,4 +2382,4 @@ declare function tryParsePartialJson(text: string): unknown | undefined;
2191
2382
 
2192
2383
  declare function createClient<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends object = DefaultAuthUser, Functions extends RagableFunctions = DefaultRagableFunctions>(options: RagableBrowserClientOptions): RagableBrowser<Database, AuthUser, Functions>;
2193
2384
 
2194
- export { type AgentChatMessage, type AgentChatParams, type AgentChatStreamDonePayload, type AgentChatStreamHandlers, type AgentChatStreamResult, type AgentChatStreamUiHandlers, type AgentChatUiAssistantMessage, type AgentChatUiSegment, type AgentChatUiStreamResult, type AgentConversation, type AgentConversationMessage, type AgentConversationSubscription, type AgentPublicChatParams, type AgentStreamAgentInfoEvent, type AgentStreamEvent, AuthBroadcastChannel, type AuthBroadcastMessage, type AuthChangeEvent, type AuthOptions, type AuthSession, type AuthSignUpCredentials, type AuthUpdateUserAttributes, type AuthUserMetadata, type BrowserAuthSession, type BrowserAuthTokens, BrowserCollectionApi, type BrowserCollectionDefinition, type BrowserCollectionFactory, type BrowserCollectionFindParams, type BrowserCollectionRecord, type BrowserCollections, type BrowserDataAuthMode, type BrowserRealtimeNotification, type BrowserRealtimeStatus, type BrowserRealtimeSubscribeParams, type BrowserRealtimeSubscription, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, BrowserStorageBucketClient, type BrowserStorageBulkDeleteResult, type BrowserStorageDownloadResult, type BrowserStorageItem, type BrowserStorageListResult, type BrowserStorageSignedUrlResult, type BrowserStorageUploadResult, type CollectionReturnMode, type CollectionRowData, type CollectionRowWithMeta, type CollectionWhere, type ColumnName, type ColumnValue, CookieStorageAdapter, DEFAULT_RAGABLE_API_BASE, type DefaultAuthUser, type DefaultRagableDatabase, type DefaultRagableFunctions, type FinishReason, type FunctionInvoker, type GenerateObjectResult, type GenerateTextResult, type HttpMethod, type Json, type JsonSchema, LocalStorageAdapter, type MailMessageDetail, type MailMessagePreview, type MailSearchParams, type MailSendParams, type MailSendResult, MemoryStorageAdapter, type Message, type PostgRESTFetch, type PostgRESTFetchParams, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, PostgrestInsertSdkErrorReturning, PostgrestInsertSdkErrorRoot, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, RagableAbortError, RagableAuth, type RagableAuthConfig, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAiClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, RagableBrowserFunctionsClient, RagableBrowserMailClient, RagableBrowserStorageClient, type RagableDatabase, RagableError, type RagableFunctionCall, type RagableFunctionContext, type RagableFunctionHandler, type RagableFunctionInvokeOptions, type RagableFunctions, RagableNetworkError, type RagableResult, RagableSdkError, type RagableTableDefinition, type RagableTableNames, RagableTimeoutError, type RequestOptions, type RetryOptions, type RunAgentChatStreamOptions, type RunQuery, type SessionStorage, SessionStorageAdapter, type SseJsonEvent, type StreamObjectParams, type StreamObjectResult, type StreamPart, type StreamTextParams, type StreamTextResult, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, type TokenUsage, type ToolCallRecord, Transport, type TransportOptions, type TransportRequest, type WhereInput, type WhereOperatorObject, asPostgrestResponse, assertPostgrestSuccess, bindFetch, buildInferenceRequestBody, buildResponseFormat, collectAssistantTextFromUiSegments, collectionRecordToRowWithMeta, collectionRecordsToRowWithMeta, createBrowserClient, createClient, createRagableBrowserClient, createStreamResultFromParts, detectStorage, effectiveDataAuth, extractErrorMessage, finalizeAgentChatUiTurn, foldAgentStreamIntoUiSegments, formatPostgrestError, formatSdkError, generateIdempotencyKey, isIncompleteAgentStreamError, mapAgentEvent, mapFireworksChunk, normalizeBrowserApiBase, parseAgentStreamAgentInfo, parseAgentStreamDone, parseSseDataLine, parseTransportResponse, readSseStream, runAgentChatStream, runAgentChatStreamForUi, runAgentChatStreamLenient, streamObjectFromContext, toRagableResult, tryParsePartialJson, unwrapPostgrest, wrapStreamTextAsObject };
2385
+ export { type AgentChatMessage, type AgentChatParams, type AgentChatStreamDonePayload, type AgentChatStreamHandlers, type AgentChatStreamResult, type AgentChatStreamUiHandlers, type AgentChatUiAssistantMessage, type AgentChatUiSegment, type AgentChatUiStreamResult, type AgentConversation, type AgentConversationMessage, type AgentConversationSubscription, type AgentPublicChatParams, type AgentStreamAgentInfoEvent, type AgentStreamEvent, AuthBroadcastChannel, type AuthBroadcastMessage, type AuthChangeEvent, type AuthOptions, type AuthSession, type AuthSignUpCredentials, type AuthUpdateUserAttributes, type AuthUserMetadata, type BrowserAuthSession, type BrowserAuthTokens, BrowserCollectionApi, type BrowserCollectionDefinition, type BrowserCollectionFactory, type BrowserCollectionFindParams, type BrowserCollectionRecord, type BrowserCollections, type BrowserDataAuthMode, type BrowserRealtimeNotification, type BrowserRealtimeStatus, type BrowserRealtimeSubscribeParams, type BrowserRealtimeSubscription, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, BrowserStorageBucketClient, type BrowserStorageBulkDeleteResult, type BrowserStorageDownloadResult, type BrowserStorageItem, type BrowserStorageListResult, type BrowserStorageSignedUrlResult, type BrowserStorageUploadResult, type CollectionReturnMode, type CollectionRowData, type CollectionRowWithMeta, type CollectionWhere, type ColumnName, type ColumnValue, CookieStorageAdapter, DEFAULT_RAGABLE_API_BASE, type DefaultAuthUser, type DefaultRagableDatabase, type DefaultRagableFunctions, type FinishReason, type FunctionInvoker, type GenerateObjectResult, type GenerateTextResult, type HttpMethod, type Json, type JsonSchema, LocalStorageAdapter, type MailMessageDetail, type MailMessagePreview, type MailSearchParams, type MailSendParams, type MailSendResult, MemoryStorageAdapter, type Message, type PostgRESTFetch, type PostgRESTFetchParams, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, PostgrestInsertSdkErrorReturning, PostgrestInsertSdkErrorRoot, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, RagableAbortError, RagableAuth, type RagableAuthConfig, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAiClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, RagableBrowserFunctionsClient, RagableBrowserMailClient, RagableBrowserStorageClient, type RagableDatabase, RagableError, type RagableFunctionCall, type RagableFunctionContext, type RagableFunctionHandler, type RagableFunctionInvokeOptions, type RagableFunctions, RagableNetworkError, type RagableResult, RagableSdkError, RagableServerClient, type RagableServerClientConfig, type RagableTableDefinition, type RagableTableNames, RagableTimeoutError, type RequestOptions, type RetryOptions, type RunAgentChatStreamOptions, type RunQuery, type ServerPrivilege, type SessionStorage, SessionStorageAdapter, type SseJsonEvent, type StreamObjectParams, type StreamObjectResult, type StreamPart, type StreamTextParams, type StreamTextResult, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, type TokenUsage, type ToolCallRecord, Transport, type TransportOptions, type TransportRequest, type WhereInput, type WhereOperatorObject, asPostgrestResponse, assertPostgrestSuccess, bindFetch, buildInferenceRequestBody, buildResponseFormat, collectAssistantTextFromUiSegments, collectionRecordToRowWithMeta, collectionRecordsToRowWithMeta, createBrowserClient, createClient, createRagableBrowserClient, createServerClient, createStreamResultFromParts, detectStorage, effectiveDataAuth, extractErrorMessage, finalizeAgentChatUiTurn, foldAgentStreamIntoUiSegments, formatPostgrestError, formatSdkError, generateIdempotencyKey, isIncompleteAgentStreamError, mapAgentEvent, mapFireworksChunk, normalizeBrowserApiBase, parseAgentStreamAgentInfo, parseAgentStreamDone, parseSseDataLine, parseTransportResponse, readSseStream, runAgentChatStream, runAgentChatStreamForUi, runAgentChatStreamLenient, streamObjectFromContext, toRagableResult, tryParsePartialJson, unwrapPostgrest, wrapStreamTextAsObject };