@ragable/sdk 0.6.12 → 0.6.13
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 +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -322,6 +322,28 @@ interface Filter {
|
|
|
322
322
|
column: string;
|
|
323
323
|
value: unknown;
|
|
324
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Chainable SELECT (PostgREST / Supabase-style). Filters and modifiers apply to the **base**
|
|
327
|
+
* table of the query (the table passed to `client.from(...)`); the `select` string controls columns
|
|
328
|
+
* and **resource embedding** (joins).
|
|
329
|
+
*
|
|
330
|
+
* **Joins** use the same embedded `select` syntax as
|
|
331
|
+
* [Supabase `.select()`](https://supabase.com/docs/reference/javascript/select) / PostgREST, for example:
|
|
332
|
+
* - `*,related_table(*)` — include related rows
|
|
333
|
+
* - `related_table!inner(*)` — inner-style embed
|
|
334
|
+
* - `related_table!fkey_column_or_constraint(*)` — disambiguate when multiple FKs exist
|
|
335
|
+
* - `alias:related_table(*)` — rename the JSON key for the nested object/array
|
|
336
|
+
*
|
|
337
|
+
* **Ragable limits** (server-side): only **one level** of embedding is supported — no nested
|
|
338
|
+
* `relation(nested(...))`. Prefer embed aliases above; top-level column rename forms like
|
|
339
|
+
* `alias:column` may not be accepted for scalar columns.
|
|
340
|
+
*
|
|
341
|
+
* **API note:** Supabase’s second `select(columns, options?)` argument (`count`, `head`, etc.) is
|
|
342
|
+
* not supported in Ragable yet; joins use the **first** argument only.
|
|
343
|
+
*
|
|
344
|
+
* For nested result shapes, pass a type argument on {@link PostgrestTableApi.select}:
|
|
345
|
+
* `from('orders').select<OrderWithLines>(\`*, lines (*)\`)`.
|
|
346
|
+
*/
|
|
325
347
|
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[]>> {
|
|
326
348
|
private readonly pgFetch;
|
|
327
349
|
private readonly databaseInstanceId;
|
|
@@ -509,7 +531,14 @@ declare class PostgrestTableApi<Database extends RagableDatabase = DefaultRagabl
|
|
|
509
531
|
private readonly databaseInstanceId;
|
|
510
532
|
private readonly table;
|
|
511
533
|
constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: TableName extends string ? string : string);
|
|
512
|
-
|
|
534
|
+
/**
|
|
535
|
+
* Start a SELECT. Pass a PostgREST `select` string; use embedded resources for joins — see
|
|
536
|
+
* {@link PostgrestSelectBuilder}.
|
|
537
|
+
*
|
|
538
|
+
* @param columns Column list and optional embeds (default `"*"`). Omitted or `"*"` means all base columns.
|
|
539
|
+
* @typeParam RowResult Row shape returned by the query; defaults to this table’s `Row`. Override when using joins.
|
|
540
|
+
*/
|
|
541
|
+
select<RowResult extends Record<string, unknown> = TableRow<Database, TableName>>(columns?: string): PostgrestSelectBuilder<RowResult, Database, TableName>;
|
|
513
542
|
insert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[], ...rest: unknown[]): PostgrestInsertRootBuilder<TableRow<Database, TableName>>;
|
|
514
543
|
update(patch: TableUpdatePatch<Database, TableName>): PostgrestUpdateRootBuilder<TableRow<Database, TableName>, Database, TableName>;
|
|
515
544
|
delete(): PostgrestDeleteRootBuilder<TableRow<Database, TableName>, Database, TableName>;
|
package/dist/index.d.ts
CHANGED
|
@@ -322,6 +322,28 @@ interface Filter {
|
|
|
322
322
|
column: string;
|
|
323
323
|
value: unknown;
|
|
324
324
|
}
|
|
325
|
+
/**
|
|
326
|
+
* Chainable SELECT (PostgREST / Supabase-style). Filters and modifiers apply to the **base**
|
|
327
|
+
* table of the query (the table passed to `client.from(...)`); the `select` string controls columns
|
|
328
|
+
* and **resource embedding** (joins).
|
|
329
|
+
*
|
|
330
|
+
* **Joins** use the same embedded `select` syntax as
|
|
331
|
+
* [Supabase `.select()`](https://supabase.com/docs/reference/javascript/select) / PostgREST, for example:
|
|
332
|
+
* - `*,related_table(*)` — include related rows
|
|
333
|
+
* - `related_table!inner(*)` — inner-style embed
|
|
334
|
+
* - `related_table!fkey_column_or_constraint(*)` — disambiguate when multiple FKs exist
|
|
335
|
+
* - `alias:related_table(*)` — rename the JSON key for the nested object/array
|
|
336
|
+
*
|
|
337
|
+
* **Ragable limits** (server-side): only **one level** of embedding is supported — no nested
|
|
338
|
+
* `relation(nested(...))`. Prefer embed aliases above; top-level column rename forms like
|
|
339
|
+
* `alias:column` may not be accepted for scalar columns.
|
|
340
|
+
*
|
|
341
|
+
* **API note:** Supabase’s second `select(columns, options?)` argument (`count`, `head`, etc.) is
|
|
342
|
+
* not supported in Ragable yet; joins use the **first** argument only.
|
|
343
|
+
*
|
|
344
|
+
* For nested result shapes, pass a type argument on {@link PostgrestTableApi.select}:
|
|
345
|
+
* `from('orders').select<OrderWithLines>(\`*, lines (*)\`)`.
|
|
346
|
+
*/
|
|
325
347
|
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[]>> {
|
|
326
348
|
private readonly pgFetch;
|
|
327
349
|
private readonly databaseInstanceId;
|
|
@@ -509,7 +531,14 @@ declare class PostgrestTableApi<Database extends RagableDatabase = DefaultRagabl
|
|
|
509
531
|
private readonly databaseInstanceId;
|
|
510
532
|
private readonly table;
|
|
511
533
|
constructor(pgFetch: PostgRESTFetch, databaseInstanceId: string, table: TableName extends string ? string : string);
|
|
512
|
-
|
|
534
|
+
/**
|
|
535
|
+
* Start a SELECT. Pass a PostgREST `select` string; use embedded resources for joins — see
|
|
536
|
+
* {@link PostgrestSelectBuilder}.
|
|
537
|
+
*
|
|
538
|
+
* @param columns Column list and optional embeds (default `"*"`). Omitted or `"*"` means all base columns.
|
|
539
|
+
* @typeParam RowResult Row shape returned by the query; defaults to this table’s `Row`. Override when using joins.
|
|
540
|
+
*/
|
|
541
|
+
select<RowResult extends Record<string, unknown> = TableRow<Database, TableName>>(columns?: string): PostgrestSelectBuilder<RowResult, Database, TableName>;
|
|
513
542
|
insert(values: TableInsertRow<Database, TableName> | TableInsertRow<Database, TableName>[], ...rest: unknown[]): PostgrestInsertRootBuilder<TableRow<Database, TableName>>;
|
|
514
543
|
update(patch: TableUpdatePatch<Database, TableName>): PostgrestUpdateRootBuilder<TableRow<Database, TableName>, Database, TableName>;
|
|
515
544
|
delete(): PostgrestDeleteRootBuilder<TableRow<Database, TableName>, Database, TableName>;
|
package/dist/index.js
CHANGED
|
@@ -1531,6 +1531,13 @@ var PostgrestTableApi = class {
|
|
|
1531
1531
|
this.databaseInstanceId = databaseInstanceId;
|
|
1532
1532
|
this.table = table;
|
|
1533
1533
|
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Start a SELECT. Pass a PostgREST `select` string; use embedded resources for joins — see
|
|
1536
|
+
* {@link PostgrestSelectBuilder}.
|
|
1537
|
+
*
|
|
1538
|
+
* @param columns Column list and optional embeds (default `"*"`). Omitted or `"*"` means all base columns.
|
|
1539
|
+
* @typeParam RowResult Row shape returned by the query; defaults to this table’s `Row`. Override when using joins.
|
|
1540
|
+
*/
|
|
1534
1541
|
select(columns = "*") {
|
|
1535
1542
|
return new PostgrestSelectBuilder(
|
|
1536
1543
|
this.pgFetch,
|