@dashai/sdk 0.8.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 +146 -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 +146 -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-BLNQ1S1C.d.cts → types-BwlzFHbq.d.cts} +109 -1
- package/dist/{types-BLNQ1S1C.d.ts → types-BwlzFHbq.d.ts} +109 -1
- package/package.json +2 -3
|
@@ -199,6 +199,16 @@ interface ClientConfig {
|
|
|
199
199
|
* Resolved tokens are attached as `Authorization: Bearer <token>`.
|
|
200
200
|
*/
|
|
201
201
|
getToken?: TokenResolver;
|
|
202
|
+
/**
|
|
203
|
+
* Custom Modules Platform v1 — a static `dwk_` API key used as the
|
|
204
|
+
* Bearer credential. Convenience over `getToken: () => apiKey` for the
|
|
205
|
+
* common "deployed module with one long-lived key" case (set it from
|
|
206
|
+
* `process.env.DASHWISE_API_KEY`). Precedence: a non-null `getToken()`
|
|
207
|
+
* result wins; otherwise `apiKey` is used. NEVER expose this to the
|
|
208
|
+
* browser — keep it server-only (route client data through server
|
|
209
|
+
* actions / route handlers).
|
|
210
|
+
*/
|
|
211
|
+
apiKey?: string;
|
|
202
212
|
/**
|
|
203
213
|
* Installation ID this client is scoped to. Required for module
|
|
204
214
|
* runtime calls. Typical values:
|
|
@@ -391,6 +401,104 @@ interface Client {
|
|
|
391
401
|
timeoutMs?: number;
|
|
392
402
|
idempotencyKey?: string;
|
|
393
403
|
}): Promise<TOutput>;
|
|
404
|
+
/**
|
|
405
|
+
* Custom Modules Platform v1 (P1b) — access to the workspace's shared
|
|
406
|
+
* Data Hub tables (the ones no-code users build), scoped by the key's
|
|
407
|
+
* datahub grants. Requires the client to be authenticated with a
|
|
408
|
+
* scoped `dwk_` API key that holds matching grants. Hits the
|
|
409
|
+
* runtime Data Hub bridge:
|
|
410
|
+
* GET/POST/PATCH/DELETE :installationId/datahub/tables/:tableId/rows…
|
|
411
|
+
*
|
|
412
|
+
* Untyped in v1 (rows are `Record<string, unknown>` — they follow the
|
|
413
|
+
* Data Hub table's own field schema, not the module manifest).
|
|
414
|
+
*/
|
|
415
|
+
datahub: DatahubClient;
|
|
416
|
+
}
|
|
417
|
+
/** Custom Modules Platform v1 (P1b) — Data Hub access surface. */
|
|
418
|
+
interface DatahubClient {
|
|
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>;
|
|
426
|
+
}
|
|
427
|
+
/** Result envelope of a Data Hub list (mirrors the backend RowQueryService). */
|
|
428
|
+
interface DatahubListResult {
|
|
429
|
+
results: Array<Record<string, unknown>>;
|
|
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;
|
|
479
|
+
}
|
|
480
|
+
/** Row CRUD against a single Data Hub table, gated by the key's grants. */
|
|
481
|
+
interface DatahubTableClient<Row = Record<string, unknown>> {
|
|
482
|
+
/**
|
|
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.
|
|
494
|
+
*/
|
|
495
|
+
list(opts?: DatahubListOpts<Row> | Record<string, string>): Promise<DatahubListResult>;
|
|
496
|
+
get(rowId: number): Promise<Record<string, unknown>>;
|
|
497
|
+
create(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
498
|
+
update(rowId: number, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
499
|
+
delete(rowId: number): Promise<{
|
|
500
|
+
success: true;
|
|
501
|
+
}>;
|
|
394
502
|
}
|
|
395
503
|
|
|
396
|
-
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,
|
|
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 };
|
|
@@ -199,6 +199,16 @@ interface ClientConfig {
|
|
|
199
199
|
* Resolved tokens are attached as `Authorization: Bearer <token>`.
|
|
200
200
|
*/
|
|
201
201
|
getToken?: TokenResolver;
|
|
202
|
+
/**
|
|
203
|
+
* Custom Modules Platform v1 — a static `dwk_` API key used as the
|
|
204
|
+
* Bearer credential. Convenience over `getToken: () => apiKey` for the
|
|
205
|
+
* common "deployed module with one long-lived key" case (set it from
|
|
206
|
+
* `process.env.DASHWISE_API_KEY`). Precedence: a non-null `getToken()`
|
|
207
|
+
* result wins; otherwise `apiKey` is used. NEVER expose this to the
|
|
208
|
+
* browser — keep it server-only (route client data through server
|
|
209
|
+
* actions / route handlers).
|
|
210
|
+
*/
|
|
211
|
+
apiKey?: string;
|
|
202
212
|
/**
|
|
203
213
|
* Installation ID this client is scoped to. Required for module
|
|
204
214
|
* runtime calls. Typical values:
|
|
@@ -391,6 +401,104 @@ interface Client {
|
|
|
391
401
|
timeoutMs?: number;
|
|
392
402
|
idempotencyKey?: string;
|
|
393
403
|
}): Promise<TOutput>;
|
|
404
|
+
/**
|
|
405
|
+
* Custom Modules Platform v1 (P1b) — access to the workspace's shared
|
|
406
|
+
* Data Hub tables (the ones no-code users build), scoped by the key's
|
|
407
|
+
* datahub grants. Requires the client to be authenticated with a
|
|
408
|
+
* scoped `dwk_` API key that holds matching grants. Hits the
|
|
409
|
+
* runtime Data Hub bridge:
|
|
410
|
+
* GET/POST/PATCH/DELETE :installationId/datahub/tables/:tableId/rows…
|
|
411
|
+
*
|
|
412
|
+
* Untyped in v1 (rows are `Record<string, unknown>` — they follow the
|
|
413
|
+
* Data Hub table's own field schema, not the module manifest).
|
|
414
|
+
*/
|
|
415
|
+
datahub: DatahubClient;
|
|
416
|
+
}
|
|
417
|
+
/** Custom Modules Platform v1 (P1b) — Data Hub access surface. */
|
|
418
|
+
interface DatahubClient {
|
|
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>;
|
|
426
|
+
}
|
|
427
|
+
/** Result envelope of a Data Hub list (mirrors the backend RowQueryService). */
|
|
428
|
+
interface DatahubListResult {
|
|
429
|
+
results: Array<Record<string, unknown>>;
|
|
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;
|
|
479
|
+
}
|
|
480
|
+
/** Row CRUD against a single Data Hub table, gated by the key's grants. */
|
|
481
|
+
interface DatahubTableClient<Row = Record<string, unknown>> {
|
|
482
|
+
/**
|
|
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.
|
|
494
|
+
*/
|
|
495
|
+
list(opts?: DatahubListOpts<Row> | Record<string, string>): Promise<DatahubListResult>;
|
|
496
|
+
get(rowId: number): Promise<Record<string, unknown>>;
|
|
497
|
+
create(body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
498
|
+
update(rowId: number, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
499
|
+
delete(rowId: number): Promise<{
|
|
500
|
+
success: true;
|
|
501
|
+
}>;
|
|
394
502
|
}
|
|
395
503
|
|
|
396
|
-
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,
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashai/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Runtime client for DashWise: typed data access + auth helpers for modules.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -81,8 +81,7 @@
|
|
|
81
81
|
"vitest": "^2.1.8"
|
|
82
82
|
},
|
|
83
83
|
"publishConfig": {
|
|
84
|
-
"access": "public"
|
|
85
|
-
"provenance": true
|
|
84
|
+
"access": "public"
|
|
86
85
|
},
|
|
87
86
|
"repository": {
|
|
88
87
|
"type": "git",
|