@ragable/sdk 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +142 -21
- package/dist/index.d.ts +142 -21
- package/dist/index.js +455 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +447 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -53,6 +53,19 @@ type TablesInsert<D extends RagableDatabase, TableName extends keyof D["public"]
|
|
|
53
53
|
type TablesUpdate<D extends RagableDatabase, TableName extends keyof D["public"]["Tables"] & string> = [D["public"]["Tables"][TableName]] extends [never] ? Record<string, unknown> : D["public"]["Tables"][TableName] extends {
|
|
54
54
|
Update: infer U;
|
|
55
55
|
} ? U extends Record<string, unknown> ? U : Record<string, unknown> : Partial<Tables<D, TableName>>;
|
|
56
|
+
/**
|
|
57
|
+
* Table name union for `client.from(...)`.
|
|
58
|
+
* When `Tables` is empty (`DefaultRagableDatabase`), any `string` is allowed.
|
|
59
|
+
*/
|
|
60
|
+
type RagableTableNames<D extends RagableDatabase> = [
|
|
61
|
+
keyof D["public"]["Tables"]
|
|
62
|
+
] extends [never] ? string : Extract<keyof D["public"]["Tables"], string>;
|
|
63
|
+
/** Row type for `from(table)` when a concrete `Database` generic is set. */
|
|
64
|
+
type TableRow<D extends RagableDatabase, T extends RagableTableNames<D>> = [keyof D["public"]["Tables"]] extends [never] ? Record<string, unknown> : T extends keyof D["public"]["Tables"] ? Tables<D, T> : Record<string, unknown>;
|
|
65
|
+
/** Insert payload for typed `from(table).insert(...)`. */
|
|
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
|
+
/** Update patch for typed `from(table).update(...)`. */
|
|
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>;
|
|
56
69
|
|
|
57
70
|
/**
|
|
58
71
|
* Native `fetch` must not be called as a detached reference (`const f = fetch; f(url)`),
|
|
@@ -242,6 +255,12 @@ interface BrowserSqlExecResult<Row extends Record<string, unknown> = Record<stri
|
|
|
242
255
|
truncated: boolean;
|
|
243
256
|
rows: Row[];
|
|
244
257
|
}
|
|
258
|
+
type FilterOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "ilike";
|
|
259
|
+
interface Filter {
|
|
260
|
+
op: FilterOp;
|
|
261
|
+
column: string;
|
|
262
|
+
value: unknown;
|
|
263
|
+
}
|
|
245
264
|
type PostgrestResult<T> = {
|
|
246
265
|
data: T;
|
|
247
266
|
error: null;
|
|
@@ -274,58 +293,160 @@ declare class PostgrestSelectBuilder<Row extends Record<string, unknown> = Recor
|
|
|
274
293
|
order(column: string, options?: {
|
|
275
294
|
ascending?: boolean;
|
|
276
295
|
}): this;
|
|
277
|
-
/** @param includeUserLimit when false, omit `.limit()` (for `.single()` / `.maybeSingle()`). */
|
|
278
296
|
private buildSelectCore;
|
|
279
297
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
280
298
|
private executeMany;
|
|
281
299
|
single(): Promise<PostgrestResult<Row>>;
|
|
282
300
|
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
283
301
|
}
|
|
284
|
-
|
|
302
|
+
/** After `.insert()`: await without `.select()` → `{ data: null }` (Supabase default). */
|
|
303
|
+
declare class PostgrestInsertRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
285
304
|
private readonly run;
|
|
286
305
|
private readonly databaseInstanceId;
|
|
287
306
|
private readonly table;
|
|
288
307
|
private readonly rows;
|
|
289
|
-
private returning;
|
|
290
308
|
constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[]);
|
|
291
|
-
|
|
309
|
+
/**
|
|
310
|
+
* Return inserted rows (Supabase: chain `.select()` to get data).
|
|
311
|
+
* @see https://supabase.com/docs/reference/javascript/insert
|
|
312
|
+
*/
|
|
313
|
+
select(columns?: string): PostgrestInsertReturningBuilder<Row>;
|
|
314
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
315
|
+
private executeNoReturn;
|
|
316
|
+
}
|
|
317
|
+
declare class PostgrestInsertReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
318
|
+
private readonly run;
|
|
319
|
+
private readonly databaseInstanceId;
|
|
320
|
+
private readonly table;
|
|
321
|
+
private readonly rows;
|
|
322
|
+
private readonly returning;
|
|
323
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], returning: string);
|
|
292
324
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
293
|
-
private
|
|
325
|
+
private executeMany;
|
|
326
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
327
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
294
328
|
}
|
|
295
|
-
|
|
329
|
+
/** Update without `.select()` → `{ data: null }` on success. */
|
|
330
|
+
declare class PostgrestUpdateRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
296
331
|
private readonly run;
|
|
297
332
|
private readonly databaseInstanceId;
|
|
298
333
|
private readonly table;
|
|
299
334
|
private readonly patch;
|
|
300
335
|
private filters;
|
|
301
|
-
private returning;
|
|
302
336
|
constructor(run: RunQuery, databaseInstanceId: string, table: string, patch: Record<string, unknown>);
|
|
303
337
|
eq(column: string, value: unknown): this;
|
|
304
|
-
|
|
338
|
+
neq(column: string, value: unknown): this;
|
|
339
|
+
gt(column: string, value: unknown): this;
|
|
340
|
+
gte(column: string, value: unknown): this;
|
|
341
|
+
lt(column: string, value: unknown): this;
|
|
342
|
+
lte(column: string, value: unknown): this;
|
|
343
|
+
like(column: string, value: unknown): this;
|
|
344
|
+
ilike(column: string, value: unknown): this;
|
|
345
|
+
/**
|
|
346
|
+
* Return updated rows (Supabase: `.update().eq().select()`).
|
|
347
|
+
* @see https://supabase.com/docs/reference/javascript/update
|
|
348
|
+
*/
|
|
349
|
+
select(columns?: string): PostgrestUpdateReturningBuilder<Row>;
|
|
350
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
351
|
+
private executeNoReturn;
|
|
352
|
+
}
|
|
353
|
+
declare class PostgrestUpdateReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
354
|
+
private readonly run;
|
|
355
|
+
private readonly databaseInstanceId;
|
|
356
|
+
private readonly table;
|
|
357
|
+
private readonly patch;
|
|
358
|
+
private readonly filters;
|
|
359
|
+
private readonly returning;
|
|
360
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, patch: Record<string, unknown>, filters: Filter[], returning: string);
|
|
305
361
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
306
|
-
private
|
|
362
|
+
private executeMany;
|
|
363
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
364
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
307
365
|
}
|
|
308
|
-
|
|
366
|
+
/** Delete without `.select()` → `{ data: null }`. */
|
|
367
|
+
declare class PostgrestDeleteRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
309
368
|
private readonly run;
|
|
310
369
|
private readonly databaseInstanceId;
|
|
311
370
|
private readonly table;
|
|
312
371
|
private filters;
|
|
313
|
-
private returning;
|
|
314
372
|
constructor(run: RunQuery, databaseInstanceId: string, table: string);
|
|
315
373
|
eq(column: string, value: unknown): this;
|
|
316
|
-
|
|
374
|
+
neq(column: string, value: unknown): this;
|
|
375
|
+
gt(column: string, value: unknown): this;
|
|
376
|
+
gte(column: string, value: unknown): this;
|
|
377
|
+
lt(column: string, value: unknown): this;
|
|
378
|
+
lte(column: string, value: unknown): this;
|
|
379
|
+
like(column: string, value: unknown): this;
|
|
380
|
+
ilike(column: string, value: unknown): this;
|
|
381
|
+
/**
|
|
382
|
+
* Return deleted rows (Supabase: `.delete().eq().select()`).
|
|
383
|
+
* @see https://supabase.com/docs/reference/javascript/delete
|
|
384
|
+
*/
|
|
385
|
+
select(columns?: string): PostgrestDeleteReturningBuilder<Row>;
|
|
386
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
387
|
+
private executeNoReturn;
|
|
388
|
+
}
|
|
389
|
+
declare class PostgrestDeleteReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
390
|
+
private readonly run;
|
|
391
|
+
private readonly databaseInstanceId;
|
|
392
|
+
private readonly table;
|
|
393
|
+
private readonly filters;
|
|
394
|
+
private readonly returning;
|
|
395
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, filters: Filter[], returning: string);
|
|
396
|
+
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
397
|
+
private executeMany;
|
|
398
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
399
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
400
|
+
}
|
|
401
|
+
interface PostgrestUpsertOptions {
|
|
402
|
+
/** Column(s) for `ON CONFLICT` — single name or comma-separated, e.g. `"id"` or `"org_id,user_id"`. */
|
|
403
|
+
onConflict: string;
|
|
404
|
+
/** When true, `ON CONFLICT DO NOTHING` (no update of existing rows). */
|
|
405
|
+
ignoreDuplicates?: boolean;
|
|
406
|
+
}
|
|
407
|
+
/** Upsert without `.select()` → `{ data: null }`. */
|
|
408
|
+
declare class PostgrestUpsertRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
409
|
+
private readonly run;
|
|
410
|
+
private readonly databaseInstanceId;
|
|
411
|
+
private readonly table;
|
|
412
|
+
private readonly rows;
|
|
413
|
+
private readonly ignoreDuplicates;
|
|
414
|
+
private readonly conflictCols;
|
|
415
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], onConflict: string, ignoreDuplicates: boolean);
|
|
416
|
+
/**
|
|
417
|
+
* Return upserted rows (Supabase: `.upsert().select()`).
|
|
418
|
+
* @see https://supabase.com/docs/reference/javascript/upsert
|
|
419
|
+
*/
|
|
420
|
+
select(columns?: string): PostgrestUpsertReturningBuilder<Row>;
|
|
421
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
422
|
+
private executeNoReturn;
|
|
423
|
+
private runUpsert;
|
|
424
|
+
/** Used by returning builder */
|
|
425
|
+
runWithReturning(returning: string): Promise<BrowserSqlExecResult<Row>>;
|
|
426
|
+
}
|
|
427
|
+
declare class PostgrestUpsertReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
428
|
+
private readonly root;
|
|
429
|
+
private readonly returning;
|
|
430
|
+
constructor(root: PostgrestUpsertRootBuilder<Row>, returning: string);
|
|
317
431
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
318
|
-
private
|
|
432
|
+
private executeMany;
|
|
433
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
434
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
319
435
|
}
|
|
320
|
-
declare class PostgrestTableApi<
|
|
436
|
+
declare class PostgrestTableApi<Database extends RagableDatabase = DefaultRagableDatabase, TableName extends RagableTableNames<Database> = RagableTableNames<Database>> {
|
|
321
437
|
private readonly run;
|
|
322
438
|
private readonly databaseInstanceId;
|
|
323
439
|
private readonly table;
|
|
324
|
-
constructor(run: RunQuery, databaseInstanceId: string, table: string);
|
|
325
|
-
select(columns?: string): PostgrestSelectBuilder<
|
|
326
|
-
insert(values:
|
|
327
|
-
update(patch:
|
|
328
|
-
delete():
|
|
440
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: TableName extends string ? string : string);
|
|
441
|
+
select(columns?: string): PostgrestSelectBuilder<TableRow<Database, TableName>>;
|
|
442
|
+
insert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[]): PostgrestInsertRootBuilder<TableRow<Database, TableName>>;
|
|
443
|
+
update(patch: TableUpdatePatch<Database, TableName>): PostgrestUpdateRootBuilder<TableRow<Database, TableName>>;
|
|
444
|
+
delete(): PostgrestDeleteRootBuilder<TableRow<Database, TableName>>;
|
|
445
|
+
/**
|
|
446
|
+
* `INSERT ... ON CONFLICT ... DO UPDATE` (or `DO NOTHING` with `ignoreDuplicates`).
|
|
447
|
+
* @see https://supabase.com/docs/reference/javascript/upsert
|
|
448
|
+
*/
|
|
449
|
+
upsert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[], options: PostgrestUpsertOptions): PostgrestUpsertRootBuilder<TableRow<Database, TableName>>;
|
|
329
450
|
}
|
|
330
451
|
|
|
331
452
|
declare function normalizeBrowserApiBase(baseUrl?: string): string;
|
|
@@ -521,7 +642,7 @@ declare class RagableBrowser<Database extends RagableDatabase = DefaultRagableDa
|
|
|
521
642
|
* Supabase-style table API: `.from('items').select().eq('id', 1).single()`.
|
|
522
643
|
* Pass `databaseInstanceId` here or set `databaseInstanceId` on the client options.
|
|
523
644
|
*/
|
|
524
|
-
from<
|
|
645
|
+
from<TableName extends RagableTableNames<Database>>(table: TableName, databaseInstanceId?: string): PostgrestTableApi<Database, TableName>;
|
|
525
646
|
}
|
|
526
647
|
/**
|
|
527
648
|
* **Supabase-equivalent** browser client factory (no org API key).
|
|
@@ -618,4 +739,4 @@ declare function createClient<Database extends RagableDatabase = DefaultRagableD
|
|
|
618
739
|
*/
|
|
619
740
|
declare function createRagableServerClient(options: RagableClientOptions): Ragable;
|
|
620
741
|
|
|
621
|
-
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentPublicChatParams, type AgentStreamEvent, type AgentSummary, AgentsClient, type BrowserAuthSession, type BrowserAuthTokens, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, type DefaultRagableDatabase, type FormatContextOptions, type Json,
|
|
742
|
+
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentPublicChatParams, type AgentStreamEvent, type AgentSummary, AgentsClient, type BrowserAuthSession, type BrowserAuthTokens, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,19 @@ type TablesInsert<D extends RagableDatabase, TableName extends keyof D["public"]
|
|
|
53
53
|
type TablesUpdate<D extends RagableDatabase, TableName extends keyof D["public"]["Tables"] & string> = [D["public"]["Tables"][TableName]] extends [never] ? Record<string, unknown> : D["public"]["Tables"][TableName] extends {
|
|
54
54
|
Update: infer U;
|
|
55
55
|
} ? U extends Record<string, unknown> ? U : Record<string, unknown> : Partial<Tables<D, TableName>>;
|
|
56
|
+
/**
|
|
57
|
+
* Table name union for `client.from(...)`.
|
|
58
|
+
* When `Tables` is empty (`DefaultRagableDatabase`), any `string` is allowed.
|
|
59
|
+
*/
|
|
60
|
+
type RagableTableNames<D extends RagableDatabase> = [
|
|
61
|
+
keyof D["public"]["Tables"]
|
|
62
|
+
] extends [never] ? string : Extract<keyof D["public"]["Tables"], string>;
|
|
63
|
+
/** Row type for `from(table)` when a concrete `Database` generic is set. */
|
|
64
|
+
type TableRow<D extends RagableDatabase, T extends RagableTableNames<D>> = [keyof D["public"]["Tables"]] extends [never] ? Record<string, unknown> : T extends keyof D["public"]["Tables"] ? Tables<D, T> : Record<string, unknown>;
|
|
65
|
+
/** Insert payload for typed `from(table).insert(...)`. */
|
|
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
|
+
/** Update patch for typed `from(table).update(...)`. */
|
|
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>;
|
|
56
69
|
|
|
57
70
|
/**
|
|
58
71
|
* Native `fetch` must not be called as a detached reference (`const f = fetch; f(url)`),
|
|
@@ -242,6 +255,12 @@ interface BrowserSqlExecResult<Row extends Record<string, unknown> = Record<stri
|
|
|
242
255
|
truncated: boolean;
|
|
243
256
|
rows: Row[];
|
|
244
257
|
}
|
|
258
|
+
type FilterOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "like" | "ilike";
|
|
259
|
+
interface Filter {
|
|
260
|
+
op: FilterOp;
|
|
261
|
+
column: string;
|
|
262
|
+
value: unknown;
|
|
263
|
+
}
|
|
245
264
|
type PostgrestResult<T> = {
|
|
246
265
|
data: T;
|
|
247
266
|
error: null;
|
|
@@ -274,58 +293,160 @@ declare class PostgrestSelectBuilder<Row extends Record<string, unknown> = Recor
|
|
|
274
293
|
order(column: string, options?: {
|
|
275
294
|
ascending?: boolean;
|
|
276
295
|
}): this;
|
|
277
|
-
/** @param includeUserLimit when false, omit `.limit()` (for `.single()` / `.maybeSingle()`). */
|
|
278
296
|
private buildSelectCore;
|
|
279
297
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
280
298
|
private executeMany;
|
|
281
299
|
single(): Promise<PostgrestResult<Row>>;
|
|
282
300
|
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
283
301
|
}
|
|
284
|
-
|
|
302
|
+
/** After `.insert()`: await without `.select()` → `{ data: null }` (Supabase default). */
|
|
303
|
+
declare class PostgrestInsertRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
285
304
|
private readonly run;
|
|
286
305
|
private readonly databaseInstanceId;
|
|
287
306
|
private readonly table;
|
|
288
307
|
private readonly rows;
|
|
289
|
-
private returning;
|
|
290
308
|
constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[]);
|
|
291
|
-
|
|
309
|
+
/**
|
|
310
|
+
* Return inserted rows (Supabase: chain `.select()` to get data).
|
|
311
|
+
* @see https://supabase.com/docs/reference/javascript/insert
|
|
312
|
+
*/
|
|
313
|
+
select(columns?: string): PostgrestInsertReturningBuilder<Row>;
|
|
314
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
315
|
+
private executeNoReturn;
|
|
316
|
+
}
|
|
317
|
+
declare class PostgrestInsertReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
318
|
+
private readonly run;
|
|
319
|
+
private readonly databaseInstanceId;
|
|
320
|
+
private readonly table;
|
|
321
|
+
private readonly rows;
|
|
322
|
+
private readonly returning;
|
|
323
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], returning: string);
|
|
292
324
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
293
|
-
private
|
|
325
|
+
private executeMany;
|
|
326
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
327
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
294
328
|
}
|
|
295
|
-
|
|
329
|
+
/** Update without `.select()` → `{ data: null }` on success. */
|
|
330
|
+
declare class PostgrestUpdateRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
296
331
|
private readonly run;
|
|
297
332
|
private readonly databaseInstanceId;
|
|
298
333
|
private readonly table;
|
|
299
334
|
private readonly patch;
|
|
300
335
|
private filters;
|
|
301
|
-
private returning;
|
|
302
336
|
constructor(run: RunQuery, databaseInstanceId: string, table: string, patch: Record<string, unknown>);
|
|
303
337
|
eq(column: string, value: unknown): this;
|
|
304
|
-
|
|
338
|
+
neq(column: string, value: unknown): this;
|
|
339
|
+
gt(column: string, value: unknown): this;
|
|
340
|
+
gte(column: string, value: unknown): this;
|
|
341
|
+
lt(column: string, value: unknown): this;
|
|
342
|
+
lte(column: string, value: unknown): this;
|
|
343
|
+
like(column: string, value: unknown): this;
|
|
344
|
+
ilike(column: string, value: unknown): this;
|
|
345
|
+
/**
|
|
346
|
+
* Return updated rows (Supabase: `.update().eq().select()`).
|
|
347
|
+
* @see https://supabase.com/docs/reference/javascript/update
|
|
348
|
+
*/
|
|
349
|
+
select(columns?: string): PostgrestUpdateReturningBuilder<Row>;
|
|
350
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
351
|
+
private executeNoReturn;
|
|
352
|
+
}
|
|
353
|
+
declare class PostgrestUpdateReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
354
|
+
private readonly run;
|
|
355
|
+
private readonly databaseInstanceId;
|
|
356
|
+
private readonly table;
|
|
357
|
+
private readonly patch;
|
|
358
|
+
private readonly filters;
|
|
359
|
+
private readonly returning;
|
|
360
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, patch: Record<string, unknown>, filters: Filter[], returning: string);
|
|
305
361
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
306
|
-
private
|
|
362
|
+
private executeMany;
|
|
363
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
364
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
307
365
|
}
|
|
308
|
-
|
|
366
|
+
/** Delete without `.select()` → `{ data: null }`. */
|
|
367
|
+
declare class PostgrestDeleteRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
309
368
|
private readonly run;
|
|
310
369
|
private readonly databaseInstanceId;
|
|
311
370
|
private readonly table;
|
|
312
371
|
private filters;
|
|
313
|
-
private returning;
|
|
314
372
|
constructor(run: RunQuery, databaseInstanceId: string, table: string);
|
|
315
373
|
eq(column: string, value: unknown): this;
|
|
316
|
-
|
|
374
|
+
neq(column: string, value: unknown): this;
|
|
375
|
+
gt(column: string, value: unknown): this;
|
|
376
|
+
gte(column: string, value: unknown): this;
|
|
377
|
+
lt(column: string, value: unknown): this;
|
|
378
|
+
lte(column: string, value: unknown): this;
|
|
379
|
+
like(column: string, value: unknown): this;
|
|
380
|
+
ilike(column: string, value: unknown): this;
|
|
381
|
+
/**
|
|
382
|
+
* Return deleted rows (Supabase: `.delete().eq().select()`).
|
|
383
|
+
* @see https://supabase.com/docs/reference/javascript/delete
|
|
384
|
+
*/
|
|
385
|
+
select(columns?: string): PostgrestDeleteReturningBuilder<Row>;
|
|
386
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
387
|
+
private executeNoReturn;
|
|
388
|
+
}
|
|
389
|
+
declare class PostgrestDeleteReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
390
|
+
private readonly run;
|
|
391
|
+
private readonly databaseInstanceId;
|
|
392
|
+
private readonly table;
|
|
393
|
+
private readonly filters;
|
|
394
|
+
private readonly returning;
|
|
395
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, filters: Filter[], returning: string);
|
|
396
|
+
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
397
|
+
private executeMany;
|
|
398
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
399
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
400
|
+
}
|
|
401
|
+
interface PostgrestUpsertOptions {
|
|
402
|
+
/** Column(s) for `ON CONFLICT` — single name or comma-separated, e.g. `"id"` or `"org_id,user_id"`. */
|
|
403
|
+
onConflict: string;
|
|
404
|
+
/** When true, `ON CONFLICT DO NOTHING` (no update of existing rows). */
|
|
405
|
+
ignoreDuplicates?: boolean;
|
|
406
|
+
}
|
|
407
|
+
/** Upsert without `.select()` → `{ data: null }`. */
|
|
408
|
+
declare class PostgrestUpsertRootBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<null>> {
|
|
409
|
+
private readonly run;
|
|
410
|
+
private readonly databaseInstanceId;
|
|
411
|
+
private readonly table;
|
|
412
|
+
private readonly rows;
|
|
413
|
+
private readonly ignoreDuplicates;
|
|
414
|
+
private readonly conflictCols;
|
|
415
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: string, rows: Record<string, unknown>[], onConflict: string, ignoreDuplicates: boolean);
|
|
416
|
+
/**
|
|
417
|
+
* Return upserted rows (Supabase: `.upsert().select()`).
|
|
418
|
+
* @see https://supabase.com/docs/reference/javascript/upsert
|
|
419
|
+
*/
|
|
420
|
+
select(columns?: string): PostgrestUpsertReturningBuilder<Row>;
|
|
421
|
+
then<TResult1 = PostgrestResult<null>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<null>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
422
|
+
private executeNoReturn;
|
|
423
|
+
private runUpsert;
|
|
424
|
+
/** Used by returning builder */
|
|
425
|
+
runWithReturning(returning: string): Promise<BrowserSqlExecResult<Row>>;
|
|
426
|
+
}
|
|
427
|
+
declare class PostgrestUpsertReturningBuilder<Row extends Record<string, unknown> = Record<string, unknown>> implements PromiseLike<PostgrestResult<Row[]>> {
|
|
428
|
+
private readonly root;
|
|
429
|
+
private readonly returning;
|
|
430
|
+
constructor(root: PostgrestUpsertRootBuilder<Row>, returning: string);
|
|
317
431
|
then<TResult1 = PostgrestResult<Row[]>, TResult2 = never>(onfulfilled?: ((value: PostgrestResult<Row[]>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
318
|
-
private
|
|
432
|
+
private executeMany;
|
|
433
|
+
single(): Promise<PostgrestResult<Row>>;
|
|
434
|
+
maybeSingle(): Promise<PostgrestResult<Row | null>>;
|
|
319
435
|
}
|
|
320
|
-
declare class PostgrestTableApi<
|
|
436
|
+
declare class PostgrestTableApi<Database extends RagableDatabase = DefaultRagableDatabase, TableName extends RagableTableNames<Database> = RagableTableNames<Database>> {
|
|
321
437
|
private readonly run;
|
|
322
438
|
private readonly databaseInstanceId;
|
|
323
439
|
private readonly table;
|
|
324
|
-
constructor(run: RunQuery, databaseInstanceId: string, table: string);
|
|
325
|
-
select(columns?: string): PostgrestSelectBuilder<
|
|
326
|
-
insert(values:
|
|
327
|
-
update(patch:
|
|
328
|
-
delete():
|
|
440
|
+
constructor(run: RunQuery, databaseInstanceId: string, table: TableName extends string ? string : string);
|
|
441
|
+
select(columns?: string): PostgrestSelectBuilder<TableRow<Database, TableName>>;
|
|
442
|
+
insert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[]): PostgrestInsertRootBuilder<TableRow<Database, TableName>>;
|
|
443
|
+
update(patch: TableUpdatePatch<Database, TableName>): PostgrestUpdateRootBuilder<TableRow<Database, TableName>>;
|
|
444
|
+
delete(): PostgrestDeleteRootBuilder<TableRow<Database, TableName>>;
|
|
445
|
+
/**
|
|
446
|
+
* `INSERT ... ON CONFLICT ... DO UPDATE` (or `DO NOTHING` with `ignoreDuplicates`).
|
|
447
|
+
* @see https://supabase.com/docs/reference/javascript/upsert
|
|
448
|
+
*/
|
|
449
|
+
upsert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[], options: PostgrestUpsertOptions): PostgrestUpsertRootBuilder<TableRow<Database, TableName>>;
|
|
329
450
|
}
|
|
330
451
|
|
|
331
452
|
declare function normalizeBrowserApiBase(baseUrl?: string): string;
|
|
@@ -521,7 +642,7 @@ declare class RagableBrowser<Database extends RagableDatabase = DefaultRagableDa
|
|
|
521
642
|
* Supabase-style table API: `.from('items').select().eq('id', 1).single()`.
|
|
522
643
|
* Pass `databaseInstanceId` here or set `databaseInstanceId` on the client options.
|
|
523
644
|
*/
|
|
524
|
-
from<
|
|
645
|
+
from<TableName extends RagableTableNames<Database>>(table: TableName, databaseInstanceId?: string): PostgrestTableApi<Database, TableName>;
|
|
525
646
|
}
|
|
526
647
|
/**
|
|
527
648
|
* **Supabase-equivalent** browser client factory (no org API key).
|
|
@@ -618,4 +739,4 @@ declare function createClient<Database extends RagableDatabase = DefaultRagableD
|
|
|
618
739
|
*/
|
|
619
740
|
declare function createRagableServerClient(options: RagableClientOptions): Ragable;
|
|
620
741
|
|
|
621
|
-
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentPublicChatParams, type AgentStreamEvent, type AgentSummary, AgentsClient, type BrowserAuthSession, type BrowserAuthTokens, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, type DefaultRagableDatabase, type FormatContextOptions, type Json,
|
|
742
|
+
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentPublicChatParams, type AgentStreamEvent, type AgentSummary, AgentsClient, type BrowserAuthSession, type BrowserAuthTokens, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, 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 };
|