@ai-matrx/records-ui 0.113.30 → 0.113.32
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/CHANGELOG.md +48 -1
- package/dist/first-page.cjs +73 -585
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.d.cts +17 -251
- package/dist/first-page.d.ts +17 -251
- package/dist/first-page.js +24 -582
- package/dist/first-page.js.map +1 -1
- package/dist/index.cjs +6520 -7879
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -827
- package/dist/index.d.ts +54 -827
- package/dist/index.js +7675 -8954
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +1619 -1605
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1498 -1470
- package/dist/pickers.js.map +1 -1
- package/package.json +5 -6
package/dist/first-page.d.cts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { RecordsClient, RecordsSeed } from '@ai-matrx/records/core';
|
|
1
|
+
import * as _ai_matrx_records_views from '@ai-matrx/records/views';
|
|
3
2
|
import { TableStyle, GroupAggregateSpec, GroupOrder } from '@ai-matrx/design-system/data-table';
|
|
4
3
|
import { FieldFormatConfig } from '@ai-matrx/design-system/field-formats';
|
|
4
|
+
import * as _ai_matrx_records_first_page from '@ai-matrx/records/first-page';
|
|
5
|
+
export { EMBEDDED_PAGE_SIZE, FirstGridPageArgs, TABLE_PAGE_SIZE, TileSpec, askChartSeed, askEntityBlockSeed, askTileSeed, firstGridPageArgs, mergeSeeds, serverRowsOf, viewFilterOf } from '@ai-matrx/records/first-page';
|
|
6
|
+
import * as _ai_matrx_records from '@ai-matrx/records';
|
|
7
|
+
import * as _ai_matrx_records_core from '@ai-matrx/records/core';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* HOW A TABLE LOOKS — colors, formats and the frozen column.
|
|
@@ -160,259 +163,22 @@ type GridPresentation = {
|
|
|
160
163
|
/** Where a grid's footer sits. */
|
|
161
164
|
type FooterPlacement = "sticky" | "inline";
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
declare const VIEW_LAYOUTS: readonly ["grid", "kanban", "calendar", "gallery", "timeline", "list"];
|
|
165
|
-
type ViewLayout = (typeof VIEW_LAYOUTS)[number];
|
|
166
|
-
/** One sort clause. The Field's key and a direction; nothing else is a sort. */
|
|
167
|
-
interface ViewSort {
|
|
168
|
-
field: string;
|
|
169
|
-
direction: "asc" | "desc";
|
|
170
|
-
}
|
|
171
|
-
/** How a saved view is ordered: by hand, by its sort, or it never said (the same as sorted). */
|
|
172
|
-
type ViewOrder = "manual" | "sorted" | null;
|
|
173
|
-
/**
|
|
174
|
-
* THE DECLARATIVE SPEC. An agent writes this whole object; a person tweaks it.
|
|
175
|
-
* Every builder component in this package takes one of these as a prop.
|
|
176
|
-
*/
|
|
177
|
-
interface SavedViewSpec {
|
|
178
|
-
name: string;
|
|
179
|
-
/** The Table this view looks at. */
|
|
180
|
-
subject: Uuid;
|
|
181
|
-
layout: ViewLayout;
|
|
182
|
-
/** Kanban: the Field whose value becomes a column. */
|
|
183
|
-
groupField?: string | null;
|
|
184
|
-
/**
|
|
185
|
-
* Kanban: a number Field to TOTAL under each column heading. It lives on the VIEW for
|
|
186
|
-
* the same reason the colours do — two people read one board two ways and neither
|
|
187
|
-
* reading is a fact about the records.
|
|
188
|
-
*/
|
|
189
|
-
measure?: string | null;
|
|
190
|
-
/**
|
|
191
|
-
* Kanban: the Field whose values cut the board into SWIMLANES across the columns — a
|
|
192
|
-
* dispatcher's board by Status, one lane per Technician (S1-PRIME VIEW-KEYS). Never the
|
|
193
|
-
* column Field itself; the store refuses that.
|
|
194
|
-
*/
|
|
195
|
-
swimlaneField?: string | null;
|
|
196
|
-
/** Kanban: the columns this view keeps shut to a strip, by the column's stored value. */
|
|
197
|
-
collapsedColumns?: string[];
|
|
198
|
-
/** Calendar: the Field that places a record in the month. */
|
|
199
|
-
dateField?: string | null;
|
|
200
|
-
/** Timeline: the Field a record's bar starts on (`start_field`). */
|
|
201
|
-
startField?: string | null;
|
|
202
|
-
/** Calendar and timeline: the Field a record ends on (`end_field`). */
|
|
203
|
-
endField?: string | null;
|
|
204
|
-
/** Gallery: the Field shown large on the card. */
|
|
205
|
-
imageField?: string | null;
|
|
206
|
-
sorts?: ViewSort[];
|
|
207
|
-
/**
|
|
208
|
-
* HOW THE VIEW IS ORDERED (ORDER-FIX): `"manual"` — the positions a person set by hand ARE the
|
|
209
|
-
* view's sort, and it carries no `sorts`; `"sorted"` or null — by `sorts`. READ ONLY: the store
|
|
210
|
-
* writes "manual" only when the rows are placed (`custom.view_record_order_set`) and turns it
|
|
211
|
-
* off itself when a sort is saved, so no patch ever sends it (`viewSettingsPatch` does not).
|
|
212
|
-
*/
|
|
213
|
-
order?: ViewOrder;
|
|
214
|
-
/**
|
|
215
|
-
* The membership Rule. The STORE decides who is in this view; this is a
|
|
216
|
-
* reference to its Rule record, never a predicate this package evaluates.
|
|
217
|
-
*/
|
|
218
|
-
ruleId?: Uuid | null;
|
|
219
|
-
/**
|
|
220
|
-
* THE FLAT FILTER a digest or a notify rule wrote the view with — the one shape
|
|
221
|
-
* `custom.record_filter_sql` compiles, by Field KEY. A view saved in the bar has
|
|
222
|
-
* none; a view saved by `DigestScheduler` ("where Status is Open") does, and the
|
|
223
|
-
* grid and the board show exactly the records it names.
|
|
224
|
-
*/
|
|
225
|
-
filters?: RecordFilter;
|
|
226
|
-
/**
|
|
227
|
-
* S2-PRIME — THE VIEW'S OWN QUESTION, as the condition builder writes it: the store's Rule
|
|
228
|
-
* shape `{op, args}`, ALL / ANY / NOT groups nested to any depth, Fields by id. Kept in the
|
|
229
|
-
* definition as `where` and asked of the store unchanged — the grid's list door, the board's
|
|
230
|
-
* headings and the dashboard's numbers compile it into the one WHERE clause
|
|
231
|
-
* (`custom.record_filter_sql`). Never stored under `filters`: that key is the flat map the
|
|
232
|
-
* digests and the notifier read, and they would refuse it by name.
|
|
233
|
-
*/
|
|
234
|
-
where?: RuleExpression | null;
|
|
235
|
-
isDefault?: boolean;
|
|
236
|
-
/**
|
|
237
|
-
* HOW THIS VIEW LOOKS — its colors, its per-column formats and its frozen
|
|
238
|
-
* column (`presentation.ts`).
|
|
239
|
-
*
|
|
240
|
-
* It lives on the VIEW and not on the Fields because two people read one
|
|
241
|
-
* table two ways and neither reading is a fact about the records; it lives on
|
|
242
|
-
* a RECORD, not a new column, because that is what makes it something an
|
|
243
|
-
* agent writes with the same `records` tool as everything else.
|
|
244
|
-
*/
|
|
245
|
-
presentation?: GridPresentation;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* A saved view as it comes back out of the store, with its row's own id.
|
|
249
|
-
*
|
|
250
|
-
* It carries no version: `custom.view_declare` MERGES one key at a time, so two
|
|
251
|
-
* tabs pressing two different controls on one view both stand, and one control
|
|
252
|
-
* pressed in both keeps the latest — how Airtable and Notion keep a view change.
|
|
253
|
-
*/
|
|
254
|
-
interface SavedView extends SavedViewSpec {
|
|
255
|
-
id: Uuid;
|
|
256
|
-
/** Where the view came from when it was moved in (the mover, the S0 repair), else null. */
|
|
257
|
-
movedFrom: Record<string, unknown> | null;
|
|
258
|
-
}
|
|
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
|
-
|
|
318
|
-
/** The table page's own page size (`TablePage`: 100 unless embedded). */
|
|
319
|
-
declare const TABLE_PAGE_SIZE = 100;
|
|
320
|
-
/**
|
|
321
|
-
* HOW MANY ROWS AN EMBEDDED TABLE READS AT A TIME (CHAIR-EMBEDDED-FIDELITY 16): its first page, and
|
|
322
|
-
* each "Show more" press brings about this many more. `embeddedLook.tsx` re-exports it.
|
|
323
|
-
*/
|
|
324
|
-
declare const EMBEDDED_PAGE_SIZE = 50;
|
|
325
|
-
interface FirstGridPageArgs {
|
|
326
|
-
p_table_id: Uuid;
|
|
327
|
-
p_filter: StoreFilter | Record<string, never>;
|
|
328
|
-
p_search: null;
|
|
329
|
-
p_sort: RecordPageSort[];
|
|
330
|
-
p_view_id: null;
|
|
331
|
-
p_limit: number;
|
|
332
|
-
p_offset: 0;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* THE VIEW'S OWN QUESTION, as the grid asks it (`TablePage` `shownFilter`): its Rule, else its flat filter,
|
|
336
|
-
* through the one question builder. Undefined when it asks none.
|
|
337
|
-
*/
|
|
338
|
-
declare function viewFilterOf(shown: Pick<SavedViewSpec, "where" | "filters"> | null, fields: readonly Field[]): StoreFilter | undefined;
|
|
339
|
-
/** The request for the plain opening, from what the screen itself reads — or null. Pure. */
|
|
340
|
-
declare function firstGridPageArgs(input: {
|
|
341
|
-
tableId: Uuid;
|
|
342
|
-
table: Pick<Table, "default_sort"> | null;
|
|
343
|
-
fields: readonly Field[];
|
|
344
|
-
/** The view as THIS person sees it (the saved view with her look over it), or null for none. */
|
|
345
|
-
shown: SavedView | null;
|
|
346
|
-
pageSize?: number;
|
|
347
|
-
/**
|
|
348
|
-
* The host draws the MERGED grid (`RecordsUiProvider grid="merged"`), which keeps a plain grouping as rows
|
|
349
|
-
* under group headers: the page is then read in group order. The classic grid opens the drill for a
|
|
350
|
-
* grouped view, so a grouped view stays unseeded there.
|
|
351
|
-
*/
|
|
352
|
-
merged?: boolean;
|
|
353
|
-
}): FirstGridPageArgs | null;
|
|
354
|
-
/**
|
|
355
|
-
* Read what the screen reads (through `client`, e.g. one served from `custom.table_page_bundle`)
|
|
356
|
-
* and build the first page's request. Null when anything it needs is not answered.
|
|
357
|
-
*/
|
|
358
|
-
declare function firstGridPageRequest(client: Pick<RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: Uuid, options?: {
|
|
166
|
+
declare const firstGridPageRequest: (client: Pick<_ai_matrx_records_core.RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: _ai_matrx_records.Uuid, options?: {
|
|
359
167
|
pageSize?: number;
|
|
360
168
|
merged?: boolean;
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
* A TABLE PAGE'S SEED, ASKED BY THE SERVER AS THE PERSON (lane SSR-ROWS).
|
|
364
|
-
*
|
|
365
|
-
* Asks what the table page opens on — the table's bundle (`custom.table_page_bundle`, through the
|
|
366
|
-
* records client exactly as the browser would), the grid's first page when `firstGridPageRequest`
|
|
367
|
-
* can predict it, and on a record page the record's bundle — through a recording data source, and
|
|
368
|
-
* answers every door answer it got as a `RecordsSeed`. The host hands that to
|
|
369
|
-
* `<RecordsSeedProvider>` (`@ai-matrx/records/react`) above the table page: the page is drawn with
|
|
370
|
-
* its rows in the server's HTML and hydrates onto them without asking again.
|
|
371
|
-
*
|
|
372
|
-
* `dataSource` is the person's own (a server supabase client carrying her session): every door
|
|
373
|
-
* decides exactly as it does from the browser. Never throws; a door that refuses is simply not in
|
|
374
|
-
* the seed, and the page asks it for itself.
|
|
375
|
-
*/
|
|
376
|
-
/**
|
|
377
|
-
* THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE (lanes SSR-ROWS-2, SSR-ROWS-3):
|
|
378
|
-
* `custom.table_page_bundle` carries a `server_rows` part — `data.server_rows` and
|
|
379
|
-
* `data.server_rows_cap_ms` (how long the page may wait for the server's rows before the browser asks
|
|
380
|
-
* for itself) resolved for the person asking in that organization. Null when the seed holds no such
|
|
381
|
-
* answer (an older store, a refused part): the host treats that as off.
|
|
382
|
-
*/
|
|
383
|
-
declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
|
|
384
|
-
on: boolean;
|
|
385
|
-
capMs: number | null;
|
|
386
|
-
} | null;
|
|
387
|
-
declare function askTablePageSeed(input: {
|
|
169
|
+
}) => Promise<_ai_matrx_records_first_page.FirstGridPageArgs | null>;
|
|
170
|
+
declare const askTablePageSeed: (input: Omit<{
|
|
388
171
|
dataSource: unknown;
|
|
389
|
-
organizationId: Uuid;
|
|
390
|
-
tableId: Uuid;
|
|
391
|
-
actor: RecordsConfig["actor"];
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Ask the grid's first page (default true). Off when the address opens something else. A function
|
|
396
|
-
* decides once the table's shape (its bundle) has been answered — it is handed everything asked so
|
|
397
|
-
* far, so a host can read the person's `server_rows` knob from the bundle (`serverRowsOf`) and ask
|
|
398
|
-
* the rows only when it is on, at no extra read.
|
|
399
|
-
*/
|
|
400
|
-
rows?: boolean | ((asked: RecordsSeed) => boolean);
|
|
401
|
-
/** The table is drawn EMBEDDED (`TablePage presentation="embedded"`, a Space's inline table): its page size. */
|
|
172
|
+
organizationId: _ai_matrx_records.Uuid;
|
|
173
|
+
tableId: _ai_matrx_records.Uuid;
|
|
174
|
+
actor: _ai_matrx_records.RecordsConfig["actor"];
|
|
175
|
+
recordId?: _ai_matrx_records.Uuid | null;
|
|
176
|
+
rows?: boolean | ((asked: _ai_matrx_records_core.RecordsSeed) => boolean);
|
|
402
177
|
embedded?: boolean;
|
|
403
178
|
pageSize?: number;
|
|
404
|
-
/**
|
|
405
|
-
* The host draws the merged grid. A view grouped by one field (no sub-levels, pivot or drill trail) is then
|
|
406
|
-
* seeded too: the page in group order, the group counts, the summary bar, and the words of the links on the
|
|
407
|
-
* page — each asked with the arguments the grid sends, so the browser's own call finds its answer.
|
|
408
|
-
*/
|
|
409
179
|
merged?: boolean;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
* views and looks are not asked.
|
|
414
|
-
*/
|
|
415
|
-
view?: SavedViewSpec | undefined;
|
|
416
|
-
}): Promise<RecordsSeed>;
|
|
180
|
+
view?: _ai_matrx_records_views.SavedViewSpec<GridPresentation> | undefined;
|
|
181
|
+
codec?: _ai_matrx_records_views.ViewPresentationCodec<GridPresentation>;
|
|
182
|
+
}, "codec">) => Promise<_ai_matrx_records_core.RecordsSeed>;
|
|
417
183
|
|
|
418
|
-
export {
|
|
184
|
+
export { askTablePageSeed, firstGridPageRequest };
|
package/dist/first-page.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { RecordsClient, RecordsSeed } from '@ai-matrx/records/core';
|
|
1
|
+
import * as _ai_matrx_records_views from '@ai-matrx/records/views';
|
|
3
2
|
import { TableStyle, GroupAggregateSpec, GroupOrder } from '@ai-matrx/design-system/data-table';
|
|
4
3
|
import { FieldFormatConfig } from '@ai-matrx/design-system/field-formats';
|
|
4
|
+
import * as _ai_matrx_records_first_page from '@ai-matrx/records/first-page';
|
|
5
|
+
export { EMBEDDED_PAGE_SIZE, FirstGridPageArgs, TABLE_PAGE_SIZE, TileSpec, askChartSeed, askEntityBlockSeed, askTileSeed, firstGridPageArgs, mergeSeeds, serverRowsOf, viewFilterOf } from '@ai-matrx/records/first-page';
|
|
6
|
+
import * as _ai_matrx_records from '@ai-matrx/records';
|
|
7
|
+
import * as _ai_matrx_records_core from '@ai-matrx/records/core';
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* HOW A TABLE LOOKS — colors, formats and the frozen column.
|
|
@@ -160,259 +163,22 @@ type GridPresentation = {
|
|
|
160
163
|
/** Where a grid's footer sits. */
|
|
161
164
|
type FooterPlacement = "sticky" | "inline";
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
declare const VIEW_LAYOUTS: readonly ["grid", "kanban", "calendar", "gallery", "timeline", "list"];
|
|
165
|
-
type ViewLayout = (typeof VIEW_LAYOUTS)[number];
|
|
166
|
-
/** One sort clause. The Field's key and a direction; nothing else is a sort. */
|
|
167
|
-
interface ViewSort {
|
|
168
|
-
field: string;
|
|
169
|
-
direction: "asc" | "desc";
|
|
170
|
-
}
|
|
171
|
-
/** How a saved view is ordered: by hand, by its sort, or it never said (the same as sorted). */
|
|
172
|
-
type ViewOrder = "manual" | "sorted" | null;
|
|
173
|
-
/**
|
|
174
|
-
* THE DECLARATIVE SPEC. An agent writes this whole object; a person tweaks it.
|
|
175
|
-
* Every builder component in this package takes one of these as a prop.
|
|
176
|
-
*/
|
|
177
|
-
interface SavedViewSpec {
|
|
178
|
-
name: string;
|
|
179
|
-
/** The Table this view looks at. */
|
|
180
|
-
subject: Uuid;
|
|
181
|
-
layout: ViewLayout;
|
|
182
|
-
/** Kanban: the Field whose value becomes a column. */
|
|
183
|
-
groupField?: string | null;
|
|
184
|
-
/**
|
|
185
|
-
* Kanban: a number Field to TOTAL under each column heading. It lives on the VIEW for
|
|
186
|
-
* the same reason the colours do — two people read one board two ways and neither
|
|
187
|
-
* reading is a fact about the records.
|
|
188
|
-
*/
|
|
189
|
-
measure?: string | null;
|
|
190
|
-
/**
|
|
191
|
-
* Kanban: the Field whose values cut the board into SWIMLANES across the columns — a
|
|
192
|
-
* dispatcher's board by Status, one lane per Technician (S1-PRIME VIEW-KEYS). Never the
|
|
193
|
-
* column Field itself; the store refuses that.
|
|
194
|
-
*/
|
|
195
|
-
swimlaneField?: string | null;
|
|
196
|
-
/** Kanban: the columns this view keeps shut to a strip, by the column's stored value. */
|
|
197
|
-
collapsedColumns?: string[];
|
|
198
|
-
/** Calendar: the Field that places a record in the month. */
|
|
199
|
-
dateField?: string | null;
|
|
200
|
-
/** Timeline: the Field a record's bar starts on (`start_field`). */
|
|
201
|
-
startField?: string | null;
|
|
202
|
-
/** Calendar and timeline: the Field a record ends on (`end_field`). */
|
|
203
|
-
endField?: string | null;
|
|
204
|
-
/** Gallery: the Field shown large on the card. */
|
|
205
|
-
imageField?: string | null;
|
|
206
|
-
sorts?: ViewSort[];
|
|
207
|
-
/**
|
|
208
|
-
* HOW THE VIEW IS ORDERED (ORDER-FIX): `"manual"` — the positions a person set by hand ARE the
|
|
209
|
-
* view's sort, and it carries no `sorts`; `"sorted"` or null — by `sorts`. READ ONLY: the store
|
|
210
|
-
* writes "manual" only when the rows are placed (`custom.view_record_order_set`) and turns it
|
|
211
|
-
* off itself when a sort is saved, so no patch ever sends it (`viewSettingsPatch` does not).
|
|
212
|
-
*/
|
|
213
|
-
order?: ViewOrder;
|
|
214
|
-
/**
|
|
215
|
-
* The membership Rule. The STORE decides who is in this view; this is a
|
|
216
|
-
* reference to its Rule record, never a predicate this package evaluates.
|
|
217
|
-
*/
|
|
218
|
-
ruleId?: Uuid | null;
|
|
219
|
-
/**
|
|
220
|
-
* THE FLAT FILTER a digest or a notify rule wrote the view with — the one shape
|
|
221
|
-
* `custom.record_filter_sql` compiles, by Field KEY. A view saved in the bar has
|
|
222
|
-
* none; a view saved by `DigestScheduler` ("where Status is Open") does, and the
|
|
223
|
-
* grid and the board show exactly the records it names.
|
|
224
|
-
*/
|
|
225
|
-
filters?: RecordFilter;
|
|
226
|
-
/**
|
|
227
|
-
* S2-PRIME — THE VIEW'S OWN QUESTION, as the condition builder writes it: the store's Rule
|
|
228
|
-
* shape `{op, args}`, ALL / ANY / NOT groups nested to any depth, Fields by id. Kept in the
|
|
229
|
-
* definition as `where` and asked of the store unchanged — the grid's list door, the board's
|
|
230
|
-
* headings and the dashboard's numbers compile it into the one WHERE clause
|
|
231
|
-
* (`custom.record_filter_sql`). Never stored under `filters`: that key is the flat map the
|
|
232
|
-
* digests and the notifier read, and they would refuse it by name.
|
|
233
|
-
*/
|
|
234
|
-
where?: RuleExpression | null;
|
|
235
|
-
isDefault?: boolean;
|
|
236
|
-
/**
|
|
237
|
-
* HOW THIS VIEW LOOKS — its colors, its per-column formats and its frozen
|
|
238
|
-
* column (`presentation.ts`).
|
|
239
|
-
*
|
|
240
|
-
* It lives on the VIEW and not on the Fields because two people read one
|
|
241
|
-
* table two ways and neither reading is a fact about the records; it lives on
|
|
242
|
-
* a RECORD, not a new column, because that is what makes it something an
|
|
243
|
-
* agent writes with the same `records` tool as everything else.
|
|
244
|
-
*/
|
|
245
|
-
presentation?: GridPresentation;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* A saved view as it comes back out of the store, with its row's own id.
|
|
249
|
-
*
|
|
250
|
-
* It carries no version: `custom.view_declare` MERGES one key at a time, so two
|
|
251
|
-
* tabs pressing two different controls on one view both stand, and one control
|
|
252
|
-
* pressed in both keeps the latest — how Airtable and Notion keep a view change.
|
|
253
|
-
*/
|
|
254
|
-
interface SavedView extends SavedViewSpec {
|
|
255
|
-
id: Uuid;
|
|
256
|
-
/** Where the view came from when it was moved in (the mover, the S0 repair), else null. */
|
|
257
|
-
movedFrom: Record<string, unknown> | null;
|
|
258
|
-
}
|
|
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
|
-
|
|
318
|
-
/** The table page's own page size (`TablePage`: 100 unless embedded). */
|
|
319
|
-
declare const TABLE_PAGE_SIZE = 100;
|
|
320
|
-
/**
|
|
321
|
-
* HOW MANY ROWS AN EMBEDDED TABLE READS AT A TIME (CHAIR-EMBEDDED-FIDELITY 16): its first page, and
|
|
322
|
-
* each "Show more" press brings about this many more. `embeddedLook.tsx` re-exports it.
|
|
323
|
-
*/
|
|
324
|
-
declare const EMBEDDED_PAGE_SIZE = 50;
|
|
325
|
-
interface FirstGridPageArgs {
|
|
326
|
-
p_table_id: Uuid;
|
|
327
|
-
p_filter: StoreFilter | Record<string, never>;
|
|
328
|
-
p_search: null;
|
|
329
|
-
p_sort: RecordPageSort[];
|
|
330
|
-
p_view_id: null;
|
|
331
|
-
p_limit: number;
|
|
332
|
-
p_offset: 0;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* THE VIEW'S OWN QUESTION, as the grid asks it (`TablePage` `shownFilter`): its Rule, else its flat filter,
|
|
336
|
-
* through the one question builder. Undefined when it asks none.
|
|
337
|
-
*/
|
|
338
|
-
declare function viewFilterOf(shown: Pick<SavedViewSpec, "where" | "filters"> | null, fields: readonly Field[]): StoreFilter | undefined;
|
|
339
|
-
/** The request for the plain opening, from what the screen itself reads — or null. Pure. */
|
|
340
|
-
declare function firstGridPageArgs(input: {
|
|
341
|
-
tableId: Uuid;
|
|
342
|
-
table: Pick<Table, "default_sort"> | null;
|
|
343
|
-
fields: readonly Field[];
|
|
344
|
-
/** The view as THIS person sees it (the saved view with her look over it), or null for none. */
|
|
345
|
-
shown: SavedView | null;
|
|
346
|
-
pageSize?: number;
|
|
347
|
-
/**
|
|
348
|
-
* The host draws the MERGED grid (`RecordsUiProvider grid="merged"`), which keeps a plain grouping as rows
|
|
349
|
-
* under group headers: the page is then read in group order. The classic grid opens the drill for a
|
|
350
|
-
* grouped view, so a grouped view stays unseeded there.
|
|
351
|
-
*/
|
|
352
|
-
merged?: boolean;
|
|
353
|
-
}): FirstGridPageArgs | null;
|
|
354
|
-
/**
|
|
355
|
-
* Read what the screen reads (through `client`, e.g. one served from `custom.table_page_bundle`)
|
|
356
|
-
* and build the first page's request. Null when anything it needs is not answered.
|
|
357
|
-
*/
|
|
358
|
-
declare function firstGridPageRequest(client: Pick<RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: Uuid, options?: {
|
|
166
|
+
declare const firstGridPageRequest: (client: Pick<_ai_matrx_records_core.RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: _ai_matrx_records.Uuid, options?: {
|
|
359
167
|
pageSize?: number;
|
|
360
168
|
merged?: boolean;
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
* A TABLE PAGE'S SEED, ASKED BY THE SERVER AS THE PERSON (lane SSR-ROWS).
|
|
364
|
-
*
|
|
365
|
-
* Asks what the table page opens on — the table's bundle (`custom.table_page_bundle`, through the
|
|
366
|
-
* records client exactly as the browser would), the grid's first page when `firstGridPageRequest`
|
|
367
|
-
* can predict it, and on a record page the record's bundle — through a recording data source, and
|
|
368
|
-
* answers every door answer it got as a `RecordsSeed`. The host hands that to
|
|
369
|
-
* `<RecordsSeedProvider>` (`@ai-matrx/records/react`) above the table page: the page is drawn with
|
|
370
|
-
* its rows in the server's HTML and hydrates onto them without asking again.
|
|
371
|
-
*
|
|
372
|
-
* `dataSource` is the person's own (a server supabase client carrying her session): every door
|
|
373
|
-
* decides exactly as it does from the browser. Never throws; a door that refuses is simply not in
|
|
374
|
-
* the seed, and the page asks it for itself.
|
|
375
|
-
*/
|
|
376
|
-
/**
|
|
377
|
-
* THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE (lanes SSR-ROWS-2, SSR-ROWS-3):
|
|
378
|
-
* `custom.table_page_bundle` carries a `server_rows` part — `data.server_rows` and
|
|
379
|
-
* `data.server_rows_cap_ms` (how long the page may wait for the server's rows before the browser asks
|
|
380
|
-
* for itself) resolved for the person asking in that organization. Null when the seed holds no such
|
|
381
|
-
* answer (an older store, a refused part): the host treats that as off.
|
|
382
|
-
*/
|
|
383
|
-
declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
|
|
384
|
-
on: boolean;
|
|
385
|
-
capMs: number | null;
|
|
386
|
-
} | null;
|
|
387
|
-
declare function askTablePageSeed(input: {
|
|
169
|
+
}) => Promise<_ai_matrx_records_first_page.FirstGridPageArgs | null>;
|
|
170
|
+
declare const askTablePageSeed: (input: Omit<{
|
|
388
171
|
dataSource: unknown;
|
|
389
|
-
organizationId: Uuid;
|
|
390
|
-
tableId: Uuid;
|
|
391
|
-
actor: RecordsConfig["actor"];
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Ask the grid's first page (default true). Off when the address opens something else. A function
|
|
396
|
-
* decides once the table's shape (its bundle) has been answered — it is handed everything asked so
|
|
397
|
-
* far, so a host can read the person's `server_rows` knob from the bundle (`serverRowsOf`) and ask
|
|
398
|
-
* the rows only when it is on, at no extra read.
|
|
399
|
-
*/
|
|
400
|
-
rows?: boolean | ((asked: RecordsSeed) => boolean);
|
|
401
|
-
/** The table is drawn EMBEDDED (`TablePage presentation="embedded"`, a Space's inline table): its page size. */
|
|
172
|
+
organizationId: _ai_matrx_records.Uuid;
|
|
173
|
+
tableId: _ai_matrx_records.Uuid;
|
|
174
|
+
actor: _ai_matrx_records.RecordsConfig["actor"];
|
|
175
|
+
recordId?: _ai_matrx_records.Uuid | null;
|
|
176
|
+
rows?: boolean | ((asked: _ai_matrx_records_core.RecordsSeed) => boolean);
|
|
402
177
|
embedded?: boolean;
|
|
403
178
|
pageSize?: number;
|
|
404
|
-
/**
|
|
405
|
-
* The host draws the merged grid. A view grouped by one field (no sub-levels, pivot or drill trail) is then
|
|
406
|
-
* seeded too: the page in group order, the group counts, the summary bar, and the words of the links on the
|
|
407
|
-
* page — each asked with the arguments the grid sends, so the browser's own call finds its answer.
|
|
408
|
-
*/
|
|
409
179
|
merged?: boolean;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
* views and looks are not asked.
|
|
414
|
-
*/
|
|
415
|
-
view?: SavedViewSpec | undefined;
|
|
416
|
-
}): Promise<RecordsSeed>;
|
|
180
|
+
view?: _ai_matrx_records_views.SavedViewSpec<GridPresentation> | undefined;
|
|
181
|
+
codec?: _ai_matrx_records_views.ViewPresentationCodec<GridPresentation>;
|
|
182
|
+
}, "codec">) => Promise<_ai_matrx_records_core.RecordsSeed>;
|
|
417
183
|
|
|
418
|
-
export {
|
|
184
|
+
export { askTablePageSeed, firstGridPageRequest };
|