@ai-matrx/records-ui 0.109.5 → 0.109.7

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.
@@ -303,6 +303,16 @@ declare function firstGridPageRequest(client: Pick<RecordsClient, "tableRead" |
303
303
  * decides exactly as it does from the browser. Never throws; a door that refuses is simply not in
304
304
  * the seed, and the page asks it for itself.
305
305
  */
306
+ /**
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.
311
+ */
312
+ declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
313
+ on: boolean;
314
+ budgetMs: number | null;
315
+ } | null;
306
316
  declare function askTablePageSeed(input: {
307
317
  dataSource: unknown;
308
318
  organizationId: Uuid;
@@ -310,11 +320,16 @@ declare function askTablePageSeed(input: {
310
320
  actor: RecordsConfig["actor"];
311
321
  /** A record page: its record's bundle (`custom.record_page_bundle`) is asked beside the table's. */
312
322
  recordId?: Uuid | null;
313
- /** Ask the grid's first page (default true). Off when the address opens something else. */
314
- rows?: boolean;
323
+ /**
324
+ * Ask the grid's first page (default true). Off when the address opens something else. A function
325
+ * decides once the table's shape (its bundle) has been answered — it is handed everything asked so
326
+ * far, so a host can read the person's `server_rows` knob from the bundle (`serverRowsOf`) and ask
327
+ * the rows only when it is on, at no extra read.
328
+ */
329
+ rows?: boolean | ((asked: RecordsSeed) => boolean);
315
330
  /** The table is drawn EMBEDDED (`TablePage presentation="embedded"`, a Space's inline table): its page size. */
316
331
  embedded?: boolean;
317
332
  pageSize?: number;
318
333
  }): Promise<RecordsSeed>;
319
334
 
320
- export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest };
335
+ export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest, serverRowsOf };
@@ -303,6 +303,16 @@ declare function firstGridPageRequest(client: Pick<RecordsClient, "tableRead" |
303
303
  * decides exactly as it does from the browser. Never throws; a door that refuses is simply not in
304
304
  * the seed, and the page asks it for itself.
305
305
  */
306
+ /**
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.
311
+ */
312
+ declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
313
+ on: boolean;
314
+ budgetMs: number | null;
315
+ } | null;
306
316
  declare function askTablePageSeed(input: {
307
317
  dataSource: unknown;
308
318
  organizationId: Uuid;
@@ -310,11 +320,16 @@ declare function askTablePageSeed(input: {
310
320
  actor: RecordsConfig["actor"];
311
321
  /** A record page: its record's bundle (`custom.record_page_bundle`) is asked beside the table's. */
312
322
  recordId?: Uuid | null;
313
- /** Ask the grid's first page (default true). Off when the address opens something else. */
314
- rows?: boolean;
323
+ /**
324
+ * Ask the grid's first page (default true). Off when the address opens something else. A function
325
+ * decides once the table's shape (its bundle) has been answered — it is handed everything asked so
326
+ * far, so a host can read the person's `server_rows` knob from the bundle (`serverRowsOf`) and ask
327
+ * the rows only when it is on, at no extra read.
328
+ */
329
+ rows?: boolean | ((asked: RecordsSeed) => boolean);
315
330
  /** The table is drawn EMBEDDED (`TablePage presentation="embedded"`, a Space's inline table): its page size. */
316
331
  embedded?: boolean;
317
332
  pageSize?: number;
318
333
  }): Promise<RecordsSeed>;
319
334
 
320
- export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest };
335
+ export { EMBEDDED_PAGE_SIZE, type FirstGridPageArgs, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest, serverRowsOf };
@@ -392,6 +392,12 @@ async function firstGridPageRequest(client, tableId, options = {}) {
392
392
  const shown = view ? applyLook(view, looks.data[view.id]) : null;
393
393
  return firstGridPageArgs({ tableId, table: table.data, fields: fields.data, shown, ...options.pageSize ? { pageSize: options.pageSize } : {} });
394
394
  }
395
+ function serverRowsOf(seed) {
396
+ const found = seed?.answers.find((a) => a.door === "server_rows");
397
+ const data = found?.data;
398
+ if (!data || typeof data !== "object") return null;
399
+ return { on: data.on === true, budgetMs: typeof data.budget_ms === "number" && data.budget_ms > 0 ? data.budget_ms : null };
400
+ }
395
401
  async function askTablePageSeed(input) {
396
402
  const recording = recordingDataSource(asRecordsDataSource(input.dataSource));
397
403
  const client = createRecordsClient({
@@ -407,7 +413,8 @@ async function askTablePageSeed(input) {
407
413
  try {
408
414
  const pageSize = input.pageSize ?? (input.embedded ? EMBEDDED_PAGE_SIZE : TABLE_PAGE_SIZE);
409
415
  const args = await firstGridPageRequest(client, input.tableId, { pageSize });
410
- if (args && input.rows !== false) {
416
+ const wantRows = typeof input.rows === "function" ? input.rows(recording.seed()) : input.rows !== false;
417
+ if (args && wantRows) {
411
418
  await client.listPage({
412
419
  table_id: args.p_table_id,
413
420
  filter: args.p_filter,
@@ -424,6 +431,6 @@ async function askTablePageSeed(input) {
424
431
  return recording.seed();
425
432
  }
426
433
 
427
- export { EMBEDDED_PAGE_SIZE, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest };
434
+ export { EMBEDDED_PAGE_SIZE, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest, serverRowsOf };
428
435
  //# sourceMappingURL=first-page.js.map
429
436
  //# sourceMappingURL=first-page.js.map