@ai-matrx/records-ui 0.110.1 → 0.110.3

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.
@@ -1,5 +1,5 @@
1
- import { Uuid, RecordFilter, RuleExpression, RecordPageSort, RecordsConfig, Table, Field } from '@ai-matrx/records';
2
- import { RecordsSeed, RecordsClient } from '@ai-matrx/records/core';
1
+ import { Uuid, RecordFilter, RuleExpression, RecordsConfig, RecordPageSort, Table, Field } from '@ai-matrx/records';
2
+ import { RecordsClient, RecordsSeed } from '@ai-matrx/records/core';
3
3
  import { TableStyle, GroupAggregateSpec, GroupOrder } from '@ai-matrx/design-system/data-table';
4
4
  import { FieldFormatConfig } from '@ai-matrx/design-system/field-formats';
5
5
 
@@ -257,6 +257,64 @@ interface SavedView extends SavedViewSpec {
257
257
  movedFrom: Record<string, unknown> | null;
258
258
  }
259
259
 
260
+ /** The block's own props that decide a chart's question. */
261
+ interface EntityChartQuestionInput {
262
+ /** The Dimension to group by. Absent: one total. */
263
+ by?: string | undefined;
264
+ /** What to count: the rows (default) or a number column summed. */
265
+ measure?: {
266
+ op: "count";
267
+ } | {
268
+ op: "sum" | "avg" | "min" | "max";
269
+ of: string;
270
+ } | undefined;
271
+ where?: Record<string, unknown> | undefined;
272
+ organization?: string | undefined;
273
+ }
274
+
275
+ type Base = {
276
+ dataSource: unknown;
277
+ organizationId: Uuid;
278
+ actor: RecordsConfig["actor"];
279
+ };
280
+ /** Several seeds as one: the later answer wins on the same door and arguments; `at` is the oldest. */
281
+ declare function mergeSeeds(...seeds: Array<RecordsSeed | null | undefined>): RecordsSeed;
282
+ /**
283
+ * AN ENTITY SOURCE'S BLOCK (a table, board or card of "task", "project", "crm_deal", "hr_employee"):
284
+ * its columns and first page, asked through the entity engine's own port with the question the block's
285
+ * `useEntityTable` sends — `question.pageSize` (the block's page size: 100, or 50 embedded) and the
286
+ * viewer's `question.search`, if any. Never throws.
287
+ */
288
+ declare function askEntityBlockSeed(input: Base & {
289
+ token: string;
290
+ question?: {
291
+ pageSize?: number | undefined;
292
+ search?: string | null | undefined;
293
+ };
294
+ }): Promise<RecordsSeed>;
295
+ /**
296
+ * AN ENTITY SOURCE'S CHART (`EntityChartBlock`): `platform.drill_ask` with the question the block sends.
297
+ * `question` is the block's own props: `by`, `measure`, `where`, `organization`.
298
+ */
299
+ declare function askChartSeed(input: Base & {
300
+ source: {
301
+ kind: "entity";
302
+ token: string;
303
+ };
304
+ question?: EntityChartQuestionInput;
305
+ }): Promise<RecordsSeed>;
306
+ /** One aggregate question of a tile: `client.recordAggregate`'s arguments but the table. */
307
+ type TileSpec = Omit<Parameters<RecordsClient["recordAggregate"]>[0], "table_id">;
308
+ /**
309
+ * A TABLE'S TILE: `custom.record_aggregate` over `tableId` for each `spec` (a tile that also shows a
310
+ * whole-table total gives both). The tile reads the number back with `useSeededAggregate`
311
+ * (`@ai-matrx/records/react`) under the very same spec.
312
+ */
313
+ declare function askTileSeed(input: Base & {
314
+ tableId: Uuid;
315
+ spec: TileSpec | TileSpec[];
316
+ }): Promise<RecordsSeed>;
317
+
260
318
  /** The table page's own page size (`TablePage`: 100 unless embedded). */
261
319
  declare const TABLE_PAGE_SIZE = 100;
262
320
  /**
@@ -304,14 +362,15 @@ declare function firstGridPageRequest(client: Pick<RecordsClient, "tableRead" |
304
362
  * the seed, and the page asks it for itself.
305
363
  */
306
364
  /**
307
- * THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE (lane SSR-ROWS-2): `custom.table_page_bundle`
308
- * carries a `server_rows` part — `data.server_rows` and `data.server_rows_budget_ms` resolved for the
309
- * person asking in that organization. Null when the seed holds no such answer (an older store, a
310
- * refused part): the host treats that as off.
365
+ * THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE (lanes SSR-ROWS-2, SSR-ROWS-3):
366
+ * `custom.table_page_bundle` carries a `server_rows` part — `data.server_rows` and
367
+ * `data.server_rows_cap_ms` (how long the page may wait for the server's rows before the browser asks
368
+ * for itself) resolved for the person asking in that organization. Null when the seed holds no such
369
+ * answer (an older store, a refused part): the host treats that as off.
311
370
  */
312
371
  declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
313
372
  on: boolean;
314
- budgetMs: number | null;
373
+ capMs: number | null;
315
374
  } | null;
316
375
  declare function askTablePageSeed(input: {
317
376
  dataSource: unknown;
@@ -332,4 +391,4 @@ declare function askTablePageSeed(input: {
332
391
  pageSize?: number;
333
392
  }): Promise<RecordsSeed>;
334
393
 
335
- export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest, serverRowsOf };
394
+ export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, type TileSpec, askChartSeed, askEntityBlockSeed, askTablePageSeed, askTileSeed, firstGridPageArgs, firstGridPageRequest, mergeSeeds, serverRowsOf };
@@ -1,5 +1,5 @@
1
- import { Uuid, RecordFilter, RuleExpression, RecordPageSort, RecordsConfig, Table, Field } from '@ai-matrx/records';
2
- import { RecordsSeed, RecordsClient } from '@ai-matrx/records/core';
1
+ import { Uuid, RecordFilter, RuleExpression, RecordsConfig, RecordPageSort, Table, Field } from '@ai-matrx/records';
2
+ import { RecordsClient, RecordsSeed } from '@ai-matrx/records/core';
3
3
  import { TableStyle, GroupAggregateSpec, GroupOrder } from '@ai-matrx/design-system/data-table';
4
4
  import { FieldFormatConfig } from '@ai-matrx/design-system/field-formats';
5
5
 
@@ -257,6 +257,64 @@ interface SavedView extends SavedViewSpec {
257
257
  movedFrom: Record<string, unknown> | null;
258
258
  }
259
259
 
260
+ /** The block's own props that decide a chart's question. */
261
+ interface EntityChartQuestionInput {
262
+ /** The Dimension to group by. Absent: one total. */
263
+ by?: string | undefined;
264
+ /** What to count: the rows (default) or a number column summed. */
265
+ measure?: {
266
+ op: "count";
267
+ } | {
268
+ op: "sum" | "avg" | "min" | "max";
269
+ of: string;
270
+ } | undefined;
271
+ where?: Record<string, unknown> | undefined;
272
+ organization?: string | undefined;
273
+ }
274
+
275
+ type Base = {
276
+ dataSource: unknown;
277
+ organizationId: Uuid;
278
+ actor: RecordsConfig["actor"];
279
+ };
280
+ /** Several seeds as one: the later answer wins on the same door and arguments; `at` is the oldest. */
281
+ declare function mergeSeeds(...seeds: Array<RecordsSeed | null | undefined>): RecordsSeed;
282
+ /**
283
+ * AN ENTITY SOURCE'S BLOCK (a table, board or card of "task", "project", "crm_deal", "hr_employee"):
284
+ * its columns and first page, asked through the entity engine's own port with the question the block's
285
+ * `useEntityTable` sends — `question.pageSize` (the block's page size: 100, or 50 embedded) and the
286
+ * viewer's `question.search`, if any. Never throws.
287
+ */
288
+ declare function askEntityBlockSeed(input: Base & {
289
+ token: string;
290
+ question?: {
291
+ pageSize?: number | undefined;
292
+ search?: string | null | undefined;
293
+ };
294
+ }): Promise<RecordsSeed>;
295
+ /**
296
+ * AN ENTITY SOURCE'S CHART (`EntityChartBlock`): `platform.drill_ask` with the question the block sends.
297
+ * `question` is the block's own props: `by`, `measure`, `where`, `organization`.
298
+ */
299
+ declare function askChartSeed(input: Base & {
300
+ source: {
301
+ kind: "entity";
302
+ token: string;
303
+ };
304
+ question?: EntityChartQuestionInput;
305
+ }): Promise<RecordsSeed>;
306
+ /** One aggregate question of a tile: `client.recordAggregate`'s arguments but the table. */
307
+ type TileSpec = Omit<Parameters<RecordsClient["recordAggregate"]>[0], "table_id">;
308
+ /**
309
+ * A TABLE'S TILE: `custom.record_aggregate` over `tableId` for each `spec` (a tile that also shows a
310
+ * whole-table total gives both). The tile reads the number back with `useSeededAggregate`
311
+ * (`@ai-matrx/records/react`) under the very same spec.
312
+ */
313
+ declare function askTileSeed(input: Base & {
314
+ tableId: Uuid;
315
+ spec: TileSpec | TileSpec[];
316
+ }): Promise<RecordsSeed>;
317
+
260
318
  /** The table page's own page size (`TablePage`: 100 unless embedded). */
261
319
  declare const TABLE_PAGE_SIZE = 100;
262
320
  /**
@@ -304,14 +362,15 @@ declare function firstGridPageRequest(client: Pick<RecordsClient, "tableRead" |
304
362
  * the seed, and the page asks it for itself.
305
363
  */
306
364
  /**
307
- * THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE (lane SSR-ROWS-2): `custom.table_page_bundle`
308
- * carries a `server_rows` part — `data.server_rows` and `data.server_rows_budget_ms` resolved for the
309
- * person asking in that organization. Null when the seed holds no such answer (an older store, a
310
- * refused part): the host treats that as off.
365
+ * THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE (lanes SSR-ROWS-2, SSR-ROWS-3):
366
+ * `custom.table_page_bundle` carries a `server_rows` part — `data.server_rows` and
367
+ * `data.server_rows_cap_ms` (how long the page may wait for the server's rows before the browser asks
368
+ * for itself) resolved for the person asking in that organization. Null when the seed holds no such
369
+ * answer (an older store, a refused part): the host treats that as off.
311
370
  */
312
371
  declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
313
372
  on: boolean;
314
- budgetMs: number | null;
373
+ capMs: number | null;
315
374
  } | null;
316
375
  declare function askTablePageSeed(input: {
317
376
  dataSource: unknown;
@@ -332,4 +391,4 @@ declare function askTablePageSeed(input: {
332
391
  pageSize?: number;
333
392
  }): Promise<RecordsSeed>;
334
393
 
335
- export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest, serverRowsOf };
394
+ export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, type TileSpec, askChartSeed, askEntityBlockSeed, askTablePageSeed, askTileSeed, firstGridPageArgs, firstGridPageRequest, mergeSeeds, serverRowsOf };