@dashai/sdk 0.9.0 → 0.10.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/deps/index.d.cts +2 -2
- package/dist/deps/index.d.ts +2 -2
- package/dist/index.cjs +101 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +101 -3
- package/dist/index.js.map +1 -1
- package/dist/query/index.d.cts +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/{types-DXsbCVkb.d.cts → types-BwlzFHbq.d.cts} +69 -7
- package/dist/{types-DXsbCVkb.d.ts → types-BwlzFHbq.d.ts} +69 -7
- package/package.json +1 -1
|
@@ -416,21 +416,83 @@ interface Client {
|
|
|
416
416
|
}
|
|
417
417
|
/** Custom Modules Platform v1 (P1b) — Data Hub access surface. */
|
|
418
418
|
interface DatahubClient {
|
|
419
|
-
/**
|
|
420
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Bind a Data Hub table by its numeric id. Pass a hand-written row
|
|
421
|
+
* interface as the type argument for typed `filter` / `sort` keys on
|
|
422
|
+
* `list()`; defaults to an untyped `Record` (Data Hub rows have no
|
|
423
|
+
* compile-time schema).
|
|
424
|
+
*/
|
|
425
|
+
table<Row = Record<string, unknown>>(tableId: number): DatahubTableClient<Row>;
|
|
421
426
|
}
|
|
422
427
|
/** Result envelope of a Data Hub list (mirrors the backend RowQueryService). */
|
|
423
428
|
interface DatahubListResult {
|
|
424
429
|
results: Array<Record<string, unknown>>;
|
|
425
430
|
count: number;
|
|
431
|
+
/**
|
|
432
|
+
* 1-based index of the next page, or `null` when on the last page.
|
|
433
|
+
* Mirrors the backend envelope (`RowQueryService.list` →
|
|
434
|
+
* `offset + size < count ? page + 1 : null`).
|
|
435
|
+
*/
|
|
436
|
+
next: number | null;
|
|
437
|
+
/**
|
|
438
|
+
* 1-based index of the previous page, or `null` when on the first page.
|
|
439
|
+
* Mirrors the backend envelope (`page > 1 ? page - 1 : null`).
|
|
440
|
+
*/
|
|
441
|
+
previous: number | null;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Typed options for {@link DatahubTableClient.list}. A higher-level
|
|
445
|
+
* mirror of {@link ListOpts} that the runtime compiles to the Data Hub
|
|
446
|
+
* bridge's flat query protocol (`filter__<field>__<op>` /
|
|
447
|
+
* `filters=<json>` / `order_by` / `search` / `size` / `page`).
|
|
448
|
+
*
|
|
449
|
+
* Unlike module tables, Data Hub rows have no compile-time row type, so
|
|
450
|
+
* `Row` defaults to a bare `Record` — pass a hand-written interface as
|
|
451
|
+
* the type argument for editor help on `filter` / `sort` keys.
|
|
452
|
+
*
|
|
453
|
+
* The raw `Record<string, string>` passthrough on `list()` stays
|
|
454
|
+
* supported for back-compat; reach for it when you need a flat param
|
|
455
|
+
* the typed shape doesn't model yet.
|
|
456
|
+
*/
|
|
457
|
+
interface DatahubListOpts<Row = Record<string, unknown>> {
|
|
458
|
+
/**
|
|
459
|
+
* Recursive filter clause, same shape as {@link ListOpts.filter}. Top
|
|
460
|
+
* level keys are AND'd; bare primitives are shorthand for
|
|
461
|
+
* `{ equal: ... }`. Simple (non-grouped) filters compile to repeated
|
|
462
|
+
* `filter__<field>__<op>=<value>` params; any clause using `AND` / `OR`
|
|
463
|
+
* grouping compiles to a single `filters=<json>` tree param (the
|
|
464
|
+
* backend's Phase 9b syntax).
|
|
465
|
+
*/
|
|
466
|
+
filter?: Where<Row>;
|
|
467
|
+
/**
|
|
468
|
+
* Sort order, same shape as {@link ListOpts.sort}. Compiles to the
|
|
469
|
+
* Data Hub `order_by` param (`-` prefix for descending), joined with
|
|
470
|
+
* commas for multi-field sorts.
|
|
471
|
+
*/
|
|
472
|
+
sort?: SortClause<Row>[];
|
|
473
|
+
/** Full-text / substring search across searchable fields → `search`. */
|
|
474
|
+
search?: string;
|
|
475
|
+
/** Page size → `size`. */
|
|
476
|
+
limit?: number;
|
|
477
|
+
/** 1-based page index → `page`. */
|
|
478
|
+
page?: number;
|
|
426
479
|
}
|
|
427
480
|
/** Row CRUD against a single Data Hub table, gated by the key's grants. */
|
|
428
|
-
interface DatahubTableClient {
|
|
481
|
+
interface DatahubTableClient<Row = Record<string, unknown>> {
|
|
429
482
|
/**
|
|
430
|
-
* List rows.
|
|
431
|
-
*
|
|
483
|
+
* List rows. Accepts either:
|
|
484
|
+
* - a typed {@link DatahubListOpts} object (`{ filter, sort, search,
|
|
485
|
+
* limit, page }`), which the client compiles to the Data Hub
|
|
486
|
+
* bridge's flat query protocol; or
|
|
487
|
+
* - the raw Baserow flat shape (`Record<string, string>`, e.g.
|
|
488
|
+
* `{ size: '50', order_by: '-created_on' }`) for back-compat and
|
|
489
|
+
* for params the typed shape doesn't model yet.
|
|
490
|
+
*
|
|
491
|
+
* The two are distinguished structurally: an options object carrying
|
|
492
|
+
* any of the known `DatahubListOpts` keys is compiled; anything else
|
|
493
|
+
* is passed through verbatim as raw query params.
|
|
432
494
|
*/
|
|
433
|
-
list(
|
|
495
|
+
list(opts?: DatahubListOpts<Row> | Record<string, string>): Promise<DatahubListResult>;
|
|
434
496
|
get(rowId: number): Promise<Record<string, unknown>>;
|
|
435
497
|
create(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
436
498
|
update(rowId: number, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -439,4 +501,4 @@ interface DatahubTableClient {
|
|
|
439
501
|
}>;
|
|
440
502
|
}
|
|
441
503
|
|
|
442
|
-
export type { BaseInsert as B, ClientConfig as C, Deps as D, FetchImpl as F, ListOpts as L, Page as P, ReadOnlyTableClient as R, SlowQueryInfo as S, TokenResolver as T, Where as W, Client as a, BaseRow as b, BaseUpdate as c, DatahubClient as d,
|
|
504
|
+
export type { BaseInsert as B, ClientConfig as C, Deps as D, FetchImpl as F, ListOpts as L, Page as P, ReadOnlyTableClient as R, SlowQueryInfo as S, TokenResolver as T, Where as W, Client as a, BaseRow as b, BaseUpdate as c, DatahubClient as d, DatahubListOpts as e, DatahubListResult as f, DatahubTableClient as g, FileRef as h, FilterOps as i, FilterValue as j, SortClause as k, SortDir as l, TableClient as m };
|
|
@@ -416,21 +416,83 @@ interface Client {
|
|
|
416
416
|
}
|
|
417
417
|
/** Custom Modules Platform v1 (P1b) — Data Hub access surface. */
|
|
418
418
|
interface DatahubClient {
|
|
419
|
-
/**
|
|
420
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Bind a Data Hub table by its numeric id. Pass a hand-written row
|
|
421
|
+
* interface as the type argument for typed `filter` / `sort` keys on
|
|
422
|
+
* `list()`; defaults to an untyped `Record` (Data Hub rows have no
|
|
423
|
+
* compile-time schema).
|
|
424
|
+
*/
|
|
425
|
+
table<Row = Record<string, unknown>>(tableId: number): DatahubTableClient<Row>;
|
|
421
426
|
}
|
|
422
427
|
/** Result envelope of a Data Hub list (mirrors the backend RowQueryService). */
|
|
423
428
|
interface DatahubListResult {
|
|
424
429
|
results: Array<Record<string, unknown>>;
|
|
425
430
|
count: number;
|
|
431
|
+
/**
|
|
432
|
+
* 1-based index of the next page, or `null` when on the last page.
|
|
433
|
+
* Mirrors the backend envelope (`RowQueryService.list` →
|
|
434
|
+
* `offset + size < count ? page + 1 : null`).
|
|
435
|
+
*/
|
|
436
|
+
next: number | null;
|
|
437
|
+
/**
|
|
438
|
+
* 1-based index of the previous page, or `null` when on the first page.
|
|
439
|
+
* Mirrors the backend envelope (`page > 1 ? page - 1 : null`).
|
|
440
|
+
*/
|
|
441
|
+
previous: number | null;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Typed options for {@link DatahubTableClient.list}. A higher-level
|
|
445
|
+
* mirror of {@link ListOpts} that the runtime compiles to the Data Hub
|
|
446
|
+
* bridge's flat query protocol (`filter__<field>__<op>` /
|
|
447
|
+
* `filters=<json>` / `order_by` / `search` / `size` / `page`).
|
|
448
|
+
*
|
|
449
|
+
* Unlike module tables, Data Hub rows have no compile-time row type, so
|
|
450
|
+
* `Row` defaults to a bare `Record` — pass a hand-written interface as
|
|
451
|
+
* the type argument for editor help on `filter` / `sort` keys.
|
|
452
|
+
*
|
|
453
|
+
* The raw `Record<string, string>` passthrough on `list()` stays
|
|
454
|
+
* supported for back-compat; reach for it when you need a flat param
|
|
455
|
+
* the typed shape doesn't model yet.
|
|
456
|
+
*/
|
|
457
|
+
interface DatahubListOpts<Row = Record<string, unknown>> {
|
|
458
|
+
/**
|
|
459
|
+
* Recursive filter clause, same shape as {@link ListOpts.filter}. Top
|
|
460
|
+
* level keys are AND'd; bare primitives are shorthand for
|
|
461
|
+
* `{ equal: ... }`. Simple (non-grouped) filters compile to repeated
|
|
462
|
+
* `filter__<field>__<op>=<value>` params; any clause using `AND` / `OR`
|
|
463
|
+
* grouping compiles to a single `filters=<json>` tree param (the
|
|
464
|
+
* backend's Phase 9b syntax).
|
|
465
|
+
*/
|
|
466
|
+
filter?: Where<Row>;
|
|
467
|
+
/**
|
|
468
|
+
* Sort order, same shape as {@link ListOpts.sort}. Compiles to the
|
|
469
|
+
* Data Hub `order_by` param (`-` prefix for descending), joined with
|
|
470
|
+
* commas for multi-field sorts.
|
|
471
|
+
*/
|
|
472
|
+
sort?: SortClause<Row>[];
|
|
473
|
+
/** Full-text / substring search across searchable fields → `search`. */
|
|
474
|
+
search?: string;
|
|
475
|
+
/** Page size → `size`. */
|
|
476
|
+
limit?: number;
|
|
477
|
+
/** 1-based page index → `page`. */
|
|
478
|
+
page?: number;
|
|
426
479
|
}
|
|
427
480
|
/** Row CRUD against a single Data Hub table, gated by the key's grants. */
|
|
428
|
-
interface DatahubTableClient {
|
|
481
|
+
interface DatahubTableClient<Row = Record<string, unknown>> {
|
|
429
482
|
/**
|
|
430
|
-
* List rows.
|
|
431
|
-
*
|
|
483
|
+
* List rows. Accepts either:
|
|
484
|
+
* - a typed {@link DatahubListOpts} object (`{ filter, sort, search,
|
|
485
|
+
* limit, page }`), which the client compiles to the Data Hub
|
|
486
|
+
* bridge's flat query protocol; or
|
|
487
|
+
* - the raw Baserow flat shape (`Record<string, string>`, e.g.
|
|
488
|
+
* `{ size: '50', order_by: '-created_on' }`) for back-compat and
|
|
489
|
+
* for params the typed shape doesn't model yet.
|
|
490
|
+
*
|
|
491
|
+
* The two are distinguished structurally: an options object carrying
|
|
492
|
+
* any of the known `DatahubListOpts` keys is compiled; anything else
|
|
493
|
+
* is passed through verbatim as raw query params.
|
|
432
494
|
*/
|
|
433
|
-
list(
|
|
495
|
+
list(opts?: DatahubListOpts<Row> | Record<string, string>): Promise<DatahubListResult>;
|
|
434
496
|
get(rowId: number): Promise<Record<string, unknown>>;
|
|
435
497
|
create(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
436
498
|
update(rowId: number, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -439,4 +501,4 @@ interface DatahubTableClient {
|
|
|
439
501
|
}>;
|
|
440
502
|
}
|
|
441
503
|
|
|
442
|
-
export type { BaseInsert as B, ClientConfig as C, Deps as D, FetchImpl as F, ListOpts as L, Page as P, ReadOnlyTableClient as R, SlowQueryInfo as S, TokenResolver as T, Where as W, Client as a, BaseRow as b, BaseUpdate as c, DatahubClient as d,
|
|
504
|
+
export type { BaseInsert as B, ClientConfig as C, Deps as D, FetchImpl as F, ListOpts as L, Page as P, ReadOnlyTableClient as R, SlowQueryInfo as S, TokenResolver as T, Where as W, Client as a, BaseRow as b, BaseUpdate as c, DatahubClient as d, DatahubListOpts as e, DatahubListResult as f, DatahubTableClient as g, FileRef as h, FilterOps as i, FilterValue as j, SortClause as k, SortDir as l, TableClient as m };
|