@ai-matrx/records 0.93.1 → 0.93.2
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 +6 -0
- package/dist/{client-D4mLGnph.d.ts → client-BKhJ6Ezn.d.ts} +8 -8
- package/dist/{client-BPcc-V2O.d.cts → client-DJFcYJ8I.d.cts} +8 -8
- package/dist/core/index.d.cts +17 -50
- package/dist/core/index.d.ts +17 -50
- package/dist/data/index.d.cts +11 -11
- package/dist/data/index.d.ts +11 -11
- package/dist/{declareTable-Br_4v6L7.d.ts → declareTable-BVvld0W6.d.ts} +4 -4
- package/dist/{declareTable-BSHX1Abl.d.cts → declareTable-y5e-Qasq.d.cts} +4 -4
- package/dist/entity/index.d.cts +7 -7
- package/dist/entity/index.d.ts +7 -7
- package/dist/{field-DjS7iId2.d.cts → field-F9BK-aUO.d.cts} +1 -1
- package/dist/{field-D-1OKy5r.d.ts → field-GR--cya9.d.ts} +1 -1
- package/dist/first-page/index.cjs +7276 -0
- package/dist/first-page/index.cjs.map +1 -0
- package/dist/first-page/index.d.cts +213 -0
- package/dist/first-page/index.d.ts +213 -0
- package/dist/first-page/index.js +7246 -0
- package/dist/first-page/index.js.map +1 -0
- package/dist/forms/index.d.cts +3 -3
- package/dist/forms/index.d.ts +3 -3
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/memory/index.d.cts +7 -7
- package/dist/memory/index.d.ts +7 -7
- package/dist/{objectOrganization-IBxZqFZQ.d.ts → objectOrganization-C2RtRmci.d.ts} +1 -1
- package/dist/{objectOrganization-CDAoE7Ft.d.cts → objectOrganization-Cec0G7mm.d.cts} +1 -1
- package/dist/{port-DyZ0GfxE.d.ts → port-Bhl_rn5k.d.ts} +3 -3
- package/dist/{port-B3UeC536.d.cts → port-CiDvXxG7.d.cts} +3 -3
- package/dist/{portal-CUwIsXsx.d.cts → portal-CL2Qtc-G.d.cts} +1 -1
- package/dist/{portal-DDOmQR1f.d.ts → portal-o9FhryoU.d.ts} +1 -1
- package/dist/{ports-DEkN-WfA.d.cts → ports-BTDZ9ydi.d.cts} +3 -3
- package/dist/{ports-YOhD5T7h.d.ts → ports-CCPhsr-V.d.ts} +3 -3
- package/dist/questions/index.cjs +7 -2
- package/dist/questions/index.cjs.map +1 -1
- package/dist/questions/index.d.cts +9 -9
- package/dist/questions/index.d.ts +9 -9
- package/dist/questions/index.js +7 -2
- package/dist/questions/index.js.map +1 -1
- package/dist/realtime/index.d.cts +3 -3
- package/dist/realtime/index.d.ts +3 -3
- package/dist/{record-zwSBU5PQ.d.cts → record-Bo1ahH3_.d.cts} +1 -1
- package/dist/{record-zwSBU5PQ.d.ts → record-Bo1ahH3_.d.ts} +1 -1
- package/dist/{relation-BbPDcXp5.d.cts → relation-BTww_Cby.d.cts} +2 -2
- package/dist/{relation-Dk9-VzY0.d.ts → relation-D8UmOxPh.d.ts} +2 -2
- package/dist/{rule-BVX1C83I.d.ts → rule-BojwTDvi.d.ts} +1 -1
- package/dist/{rule-CbBXN-FW.d.cts → rule-G4UQndi-.d.cts} +1 -1
- package/dist/search/index.d.cts +1 -1
- package/dist/search/index.d.ts +1 -1
- package/dist/seed-CQkIf8UR.d.cts +37 -0
- package/dist/seed-Dz8Hi2LZ.d.ts +37 -0
- package/dist/setup/index.d.cts +12 -12
- package/dist/setup/index.d.ts +12 -12
- package/dist/{subscription-BGgwsJ8c.d.ts → subscription-1ik9orQK.d.ts} +3 -3
- package/dist/{subscription-DVM2vL4e.d.cts → subscription-x61fFv_7.d.cts} +3 -3
- package/dist/{table-kind-BGokuDJj.d.ts → table-kind-C2bMlOaV.d.ts} +4 -4
- package/dist/{table-kind-C5ZLyOxE.d.cts → table-kind-C3PlCE9_.d.cts} +4 -4
- package/dist/templates/index.d.cts +10 -10
- package/dist/templates/index.d.ts +10 -10
- package/dist/typed-table/index.d.cts +10 -10
- package/dist/typed-table/index.d.ts +10 -10
- package/dist/{types-DB4J-zIt.d.ts → types-BBwIxf_z.d.ts} +2 -2
- package/dist/{types-reNR-zMe.d.cts → types-BTydwrlW.d.cts} +2 -2
- package/dist/{types-Bg1q6qwq.d.cts → types-C433sVT-.d.cts} +2 -2
- package/dist/{types-D31PewA2.d.ts → types-DYXymeSx.d.ts} +2 -2
- package/dist/{types-C3ywxkho.d.ts → types-Gur64NY0.d.ts} +2 -2
- package/dist/{types-DtEP7XLv.d.cts → types-_D768Jzt.d.cts} +2 -2
- package/dist/use-cases/index.d.cts +5 -5
- package/dist/use-cases/index.d.ts +5 -5
- package/dist/{validate-BWqeG2sK.d.ts → validate-BRfOuXKD.d.ts} +1 -1
- package/dist/{validate-QdnFP97_.d.cts → validate-CmZ93paU.d.cts} +1 -1
- package/dist/views/index.cjs +102 -0
- package/dist/views/index.cjs.map +1 -1
- package/dist/views/index.d.cts +51 -396
- package/dist/views/index.d.ts +51 -396
- package/dist/views/index.js +102 -0
- package/dist/views/index.js.map +1 -1
- package/dist/views-B156FsIH.d.cts +396 -0
- package/dist/views-Bny6SBX0.d.ts +396 -0
- package/package.json +12 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { a as AggregateOperation, b as AggregateMeasure, S as StoreFilter } from '../subscription-x61fFv_7.cjs';
|
|
2
|
+
import { F as Field } from '../field-F9BK-aUO.cjs';
|
|
3
|
+
import { k as RecordPageSort, U as Uuid } from '../record-Bo1ahH3_.cjs';
|
|
4
|
+
import { T as Table, D as DrillQuestion } from '../table-kind-C3PlCE9_.cjs';
|
|
5
|
+
import { b as RecordsConfig } from '../ports-BTDZ9ydi.cjs';
|
|
6
|
+
import { R as RecordsClient } from '../client-DJFcYJ8I.cjs';
|
|
7
|
+
import { R as RecordsSeed } from '../seed-CQkIf8UR.cjs';
|
|
8
|
+
import { Q as Query } from '../types-C433sVT-.cjs';
|
|
9
|
+
import { V as ViewPresentationDocument, S as SavedViewSpec, a as ViewPresentationCodec, b as SavedView } from '../views-B156FsIH.cjs';
|
|
10
|
+
import '../rule-G4UQndi-.cjs';
|
|
11
|
+
import '../relation-BTww_Cby.cjs';
|
|
12
|
+
import '../portal-CL2Qtc-G.cjs';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Does this column hold NUMBERS the store keeps — a number, money or percent column, or the record number
|
|
16
|
+
* (`config.system: autonumber`, worked out once on save and kept)?
|
|
17
|
+
*/
|
|
18
|
+
declare function holdsNumbers(field: Field): boolean;
|
|
19
|
+
/** How the store should compare a column's values when it sorts by it. The record number sorts 1, 2 … 10. */
|
|
20
|
+
declare function sortAsFor(field: Field): NonNullable<RecordPageSort["as"]>;
|
|
21
|
+
/** One column sort, by Field key — the grid's header sort and the table's default sort share it. */
|
|
22
|
+
interface ColumnSort {
|
|
23
|
+
/** The Field KEY. */
|
|
24
|
+
id: string;
|
|
25
|
+
direction: "asc" | "desc";
|
|
26
|
+
}
|
|
27
|
+
/** A header sort in the store's page-order shape. A sort on a column that is gone is no sort. */
|
|
28
|
+
declare function pageSortFor(fields: readonly Field[], sort: ColumnSort | null | undefined): RecordPageSort[];
|
|
29
|
+
/**
|
|
30
|
+
* THE TABLE'S OWN SORT — or `null`. The store writes `default_sort` as `[{field, direction}]` with `field` a Field
|
|
31
|
+
* KEY; older rows hold a bare key or `"key desc"`, so all three shapes are read. A sort naming a column the table
|
|
32
|
+
* no longer has is DROPPED, never guessed at. Only the first sort key is used.
|
|
33
|
+
*/
|
|
34
|
+
declare function defaultSortOf(table: Pick<Table, "default_sort"> | null | undefined, fields: readonly Field[]): ColumnSort | null;
|
|
35
|
+
/** The parts of a grid grouping the reads depend on (records-ui's `GridGrouping` is one). */
|
|
36
|
+
interface GroupingShape {
|
|
37
|
+
field: string;
|
|
38
|
+
then?: readonly unknown[] | undefined;
|
|
39
|
+
across?: unknown;
|
|
40
|
+
trail?: readonly unknown[] | undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A grouping the merged grid keeps as ROWS under group headers: one level, no pivot, no drill trail. Anything else
|
|
44
|
+
* opens the drill, which reads other doors.
|
|
45
|
+
*/
|
|
46
|
+
declare function isPlainGrouping<G extends GroupingShape>(grouping: G | undefined): grouping is G;
|
|
47
|
+
/** The page is asked in group order first, then in the sort the person chose. */
|
|
48
|
+
declare function groupedPageSort(fields: readonly Field[], groupKey: string | null, sort: RecordPageSort[]): RecordPageSort[];
|
|
49
|
+
/** Every summary the store answers (`custom.record_aggregate`); a chosen summary outside it is never sent. */
|
|
50
|
+
declare const SUMMARY_OPERATIONS: readonly AggregateOperation[];
|
|
51
|
+
/** Every group's count and each chosen summary: `record_aggregate`'s measures when grouped by the grouping column. */
|
|
52
|
+
declare function groupFactMeasures(chosen: Record<string, string>): AggregateMeasure[];
|
|
53
|
+
/** The summary bar's measures over the whole table: none when nothing is chosen. */
|
|
54
|
+
declare function summaryBarMeasures(chosen: Record<string, string>): AggregateMeasure[];
|
|
55
|
+
/** The keys of the choice columns, in the table's field order: each has a header filter list with counts. */
|
|
56
|
+
declare function choiceFieldKeys(fields: readonly Field[]): string[];
|
|
57
|
+
/** How many links a grid cell draws of a reverse column (the chips; the rest is "+N"). */
|
|
58
|
+
declare const REVERSE_CELL_CHIPS = 3;
|
|
59
|
+
/**
|
|
60
|
+
* THE VIEW'S OWN QUESTION, as the grid asks it: its Rule, else its flat filter (an empty flat filter is none).
|
|
61
|
+
* The grid's column filters are laid over this by records-ui's `storeQuestion`; with none, this is the question.
|
|
62
|
+
*/
|
|
63
|
+
declare function viewFilterOf(shown: {
|
|
64
|
+
where?: StoreFilter | null | undefined;
|
|
65
|
+
filters?: StoreFilter | null | undefined;
|
|
66
|
+
} | null, _fields?: readonly Field[]): StoreFilter | undefined;
|
|
67
|
+
|
|
68
|
+
/** The table page's own page size (100 unless embedded). */
|
|
69
|
+
declare const TABLE_PAGE_SIZE = 100;
|
|
70
|
+
/** How many rows an embedded table reads at a time: its first page, and each "Show more". */
|
|
71
|
+
declare const EMBEDDED_PAGE_SIZE = 50;
|
|
72
|
+
interface FirstGridPageArgs {
|
|
73
|
+
p_table_id: Uuid;
|
|
74
|
+
p_filter: StoreFilter | Record<string, never>;
|
|
75
|
+
p_search: null;
|
|
76
|
+
p_sort: RecordPageSort[];
|
|
77
|
+
p_view_id: null;
|
|
78
|
+
p_limit: number;
|
|
79
|
+
p_offset: 0;
|
|
80
|
+
}
|
|
81
|
+
/** The request for the plain opening, from what the screen itself reads — or null. Pure. */
|
|
82
|
+
declare function firstGridPageArgs<P = ViewPresentationDocument>(input: {
|
|
83
|
+
tableId: Uuid;
|
|
84
|
+
table: Pick<Table, "default_sort"> | null;
|
|
85
|
+
fields: readonly Field[];
|
|
86
|
+
/** The view as THIS person sees it (the saved view with her look over it), or null for none. */
|
|
87
|
+
shown: SavedView<P> | null;
|
|
88
|
+
pageSize?: number;
|
|
89
|
+
/**
|
|
90
|
+
* The host draws the MERGED grid, which keeps a plain grouping as rows under group headers: the page is then
|
|
91
|
+
* read in group order. The classic grid opens the drill for a grouped view, so a grouped view stays unseeded.
|
|
92
|
+
*/
|
|
93
|
+
merged?: boolean;
|
|
94
|
+
}): FirstGridPageArgs | null;
|
|
95
|
+
type OpeningOptions<P> = {
|
|
96
|
+
pageSize?: number;
|
|
97
|
+
merged?: boolean;
|
|
98
|
+
view?: SavedViewSpec<P> | undefined;
|
|
99
|
+
codec?: ViewPresentationCodec<P>;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Read what the screen reads (through `client`, e.g. one served from `custom.table_page_bundle`) and build the first
|
|
103
|
+
* page's request. Null when anything it needs is not answered.
|
|
104
|
+
*/
|
|
105
|
+
declare function firstGridPageRequest<P = ViewPresentationDocument>(client: Pick<RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: Uuid, options?: Omit<OpeningOptions<P>, "view">): Promise<FirstGridPageArgs | null>;
|
|
106
|
+
/**
|
|
107
|
+
* THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE: `custom.table_page_bundle` carries a `server_rows` part
|
|
108
|
+
* (whether the page may wait for the server's rows, and for how long) resolved for the person asking. Null when the
|
|
109
|
+
* seed holds no such answer (an older store, a refused part): the host treats that as off.
|
|
110
|
+
*/
|
|
111
|
+
declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
|
|
112
|
+
on: boolean;
|
|
113
|
+
capMs: number | null;
|
|
114
|
+
} | null;
|
|
115
|
+
/**
|
|
116
|
+
* A TABLE PAGE'S SEED, ASKED BY THE SERVER AS THE PERSON.
|
|
117
|
+
*
|
|
118
|
+
* Asks what the table page opens on — the table's bundle, the grid's first page when it can be predicted, and on a
|
|
119
|
+
* record page the record's bundle — through a recording data source, and answers every door answer it got as a
|
|
120
|
+
* `RecordsSeed`. The host hands that to `<RecordsSeedProvider>` (`@ai-matrx/records/react`) above the table page.
|
|
121
|
+
* `dataSource` is the person's own (a server Supabase client carrying her session). Never throws.
|
|
122
|
+
*/
|
|
123
|
+
declare function askTablePageSeed<P = ViewPresentationDocument>(input: {
|
|
124
|
+
dataSource: unknown;
|
|
125
|
+
organizationId: Uuid;
|
|
126
|
+
tableId: Uuid;
|
|
127
|
+
actor: RecordsConfig["actor"];
|
|
128
|
+
/** A record page: its record's bundle (`custom.record_page_bundle`) is asked beside the table's. */
|
|
129
|
+
recordId?: Uuid | null;
|
|
130
|
+
/**
|
|
131
|
+
* Ask the grid's first page (default true). A function decides once the table's bundle has been answered — it is
|
|
132
|
+
* handed everything asked so far, so a host can read the person's `server_rows` knob (`serverRowsOf`) first.
|
|
133
|
+
*/
|
|
134
|
+
rows?: boolean | ((asked: RecordsSeed) => boolean);
|
|
135
|
+
/** The table is drawn EMBEDDED: its page size. */
|
|
136
|
+
embedded?: boolean;
|
|
137
|
+
pageSize?: number;
|
|
138
|
+
/** The host draws the merged grid: a view grouped by one field is seeded too (group counts, summary bar, link words). */
|
|
139
|
+
merged?: boolean;
|
|
140
|
+
/** THE VIEW THE HOST HANDS THE GRID, for a table with no saved view behind it. */
|
|
141
|
+
view?: SavedViewSpec<P> | undefined;
|
|
142
|
+
/** The host's view codec (records-ui binds its grid look). Left out: the plain document. */
|
|
143
|
+
codec?: ViewPresentationCodec<P>;
|
|
144
|
+
}): Promise<RecordsSeed>;
|
|
145
|
+
type Base = {
|
|
146
|
+
dataSource: unknown;
|
|
147
|
+
organizationId: Uuid;
|
|
148
|
+
actor: RecordsConfig["actor"];
|
|
149
|
+
};
|
|
150
|
+
/** A standard source's first read: its page size and the viewer's search (an empty search is none). */
|
|
151
|
+
declare function entityTableQuery(options?: {
|
|
152
|
+
pageSize?: number | undefined;
|
|
153
|
+
search?: string | null | undefined;
|
|
154
|
+
}): Query;
|
|
155
|
+
/** The block's own props that decide a chart's question. */
|
|
156
|
+
interface EntityChartQuestionInput {
|
|
157
|
+
/** The Dimension to group by. Absent: one total. */
|
|
158
|
+
by?: string | undefined;
|
|
159
|
+
/** What to count: the rows (default) or a number column summed. */
|
|
160
|
+
measure?: {
|
|
161
|
+
op: "count";
|
|
162
|
+
} | {
|
|
163
|
+
op: "sum" | "avg" | "min" | "max";
|
|
164
|
+
of: string;
|
|
165
|
+
} | undefined;
|
|
166
|
+
where?: Record<string, unknown> | undefined;
|
|
167
|
+
organization?: string | undefined;
|
|
168
|
+
}
|
|
169
|
+
/** The chart's `platform.drill_ask` question. */
|
|
170
|
+
declare function entityChartQuestion(input: EntityChartQuestionInput): DrillQuestion & {
|
|
171
|
+
organization?: string;
|
|
172
|
+
};
|
|
173
|
+
/** Several seeds as one: the later answer wins on the same door and arguments; `at` is the oldest. */
|
|
174
|
+
declare function mergeSeeds(...seeds: Array<RecordsSeed | null | undefined>): RecordsSeed;
|
|
175
|
+
/**
|
|
176
|
+
* AN ENTITY SOURCE'S BLOCK (a table, board or card of "task", "project", "crm_deal"): its columns and first page,
|
|
177
|
+
* asked through the entity engine's own port with the question the block's `useEntityTable` sends. Never throws.
|
|
178
|
+
*/
|
|
179
|
+
declare function askEntityBlockSeed(input: Base & {
|
|
180
|
+
token: string;
|
|
181
|
+
question?: {
|
|
182
|
+
pageSize?: number | undefined;
|
|
183
|
+
search?: string | null | undefined;
|
|
184
|
+
};
|
|
185
|
+
}): Promise<RecordsSeed>;
|
|
186
|
+
/** AN ENTITY SOURCE'S CHART: `platform.drill_ask` with the question the block sends. */
|
|
187
|
+
declare function askChartSeed(input: Base & {
|
|
188
|
+
source: {
|
|
189
|
+
kind: "entity";
|
|
190
|
+
token: string;
|
|
191
|
+
};
|
|
192
|
+
question?: EntityChartQuestionInput;
|
|
193
|
+
}): Promise<RecordsSeed>;
|
|
194
|
+
/** One aggregate question of a tile: `client.recordAggregate`'s arguments but the table. */
|
|
195
|
+
type TileSpec = Omit<Parameters<RecordsClient["recordAggregate"]>[0], "table_id">;
|
|
196
|
+
/** A TABLE'S TILE: `custom.record_aggregate` over `tableId` for each `spec`. Read back with `useSeededAggregate`. */
|
|
197
|
+
declare function askTileSeed(input: Base & {
|
|
198
|
+
tableId: Uuid;
|
|
199
|
+
spec: TileSpec | TileSpec[];
|
|
200
|
+
}): Promise<RecordsSeed>;
|
|
201
|
+
/**
|
|
202
|
+
* THE FIRST PAGE WITH A HOST'S VIEW CODEC BOUND ONCE (records-ui binds its grid look): the host re-exports these
|
|
203
|
+
* under the same names — bindings of the one definition here, never a second body.
|
|
204
|
+
*/
|
|
205
|
+
declare function bindFirstPageCodec<P>(codec: ViewPresentationCodec<P>): {
|
|
206
|
+
firstGridPageRequest: (client: Pick<RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: Uuid, options?: {
|
|
207
|
+
pageSize?: number;
|
|
208
|
+
merged?: boolean;
|
|
209
|
+
}) => Promise<FirstGridPageArgs | null>;
|
|
210
|
+
askTablePageSeed: (input: Omit<Parameters<typeof askTablePageSeed<P>>[0], "codec">) => Promise<RecordsSeed>;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export { type ColumnSort, EMBEDDED_PAGE_SIZE, type EntityChartQuestionInput, type FirstGridPageArgs, type GroupingShape, REVERSE_CELL_CHIPS, SUMMARY_OPERATIONS, TABLE_PAGE_SIZE, type TileSpec, askChartSeed, askEntityBlockSeed, askTablePageSeed, askTileSeed, bindFirstPageCodec, choiceFieldKeys, defaultSortOf, entityChartQuestion, entityTableQuery, firstGridPageArgs, firstGridPageRequest, groupFactMeasures, groupedPageSort, holdsNumbers, isPlainGrouping, mergeSeeds, pageSortFor, serverRowsOf, sortAsFor, summaryBarMeasures, viewFilterOf };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { a as AggregateOperation, b as AggregateMeasure, S as StoreFilter } from '../subscription-1ik9orQK.js';
|
|
2
|
+
import { F as Field } from '../field-GR--cya9.js';
|
|
3
|
+
import { k as RecordPageSort, U as Uuid } from '../record-Bo1ahH3_.js';
|
|
4
|
+
import { T as Table, D as DrillQuestion } from '../table-kind-C2bMlOaV.js';
|
|
5
|
+
import { b as RecordsConfig } from '../ports-CCPhsr-V.js';
|
|
6
|
+
import { R as RecordsClient } from '../client-BKhJ6Ezn.js';
|
|
7
|
+
import { R as RecordsSeed } from '../seed-Dz8Hi2LZ.js';
|
|
8
|
+
import { Q as Query } from '../types-BBwIxf_z.js';
|
|
9
|
+
import { V as ViewPresentationDocument, S as SavedViewSpec, a as ViewPresentationCodec, b as SavedView } from '../views-Bny6SBX0.js';
|
|
10
|
+
import '../rule-BojwTDvi.js';
|
|
11
|
+
import '../relation-D8UmOxPh.js';
|
|
12
|
+
import '../portal-o9FhryoU.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Does this column hold NUMBERS the store keeps — a number, money or percent column, or the record number
|
|
16
|
+
* (`config.system: autonumber`, worked out once on save and kept)?
|
|
17
|
+
*/
|
|
18
|
+
declare function holdsNumbers(field: Field): boolean;
|
|
19
|
+
/** How the store should compare a column's values when it sorts by it. The record number sorts 1, 2 … 10. */
|
|
20
|
+
declare function sortAsFor(field: Field): NonNullable<RecordPageSort["as"]>;
|
|
21
|
+
/** One column sort, by Field key — the grid's header sort and the table's default sort share it. */
|
|
22
|
+
interface ColumnSort {
|
|
23
|
+
/** The Field KEY. */
|
|
24
|
+
id: string;
|
|
25
|
+
direction: "asc" | "desc";
|
|
26
|
+
}
|
|
27
|
+
/** A header sort in the store's page-order shape. A sort on a column that is gone is no sort. */
|
|
28
|
+
declare function pageSortFor(fields: readonly Field[], sort: ColumnSort | null | undefined): RecordPageSort[];
|
|
29
|
+
/**
|
|
30
|
+
* THE TABLE'S OWN SORT — or `null`. The store writes `default_sort` as `[{field, direction}]` with `field` a Field
|
|
31
|
+
* KEY; older rows hold a bare key or `"key desc"`, so all three shapes are read. A sort naming a column the table
|
|
32
|
+
* no longer has is DROPPED, never guessed at. Only the first sort key is used.
|
|
33
|
+
*/
|
|
34
|
+
declare function defaultSortOf(table: Pick<Table, "default_sort"> | null | undefined, fields: readonly Field[]): ColumnSort | null;
|
|
35
|
+
/** The parts of a grid grouping the reads depend on (records-ui's `GridGrouping` is one). */
|
|
36
|
+
interface GroupingShape {
|
|
37
|
+
field: string;
|
|
38
|
+
then?: readonly unknown[] | undefined;
|
|
39
|
+
across?: unknown;
|
|
40
|
+
trail?: readonly unknown[] | undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A grouping the merged grid keeps as ROWS under group headers: one level, no pivot, no drill trail. Anything else
|
|
44
|
+
* opens the drill, which reads other doors.
|
|
45
|
+
*/
|
|
46
|
+
declare function isPlainGrouping<G extends GroupingShape>(grouping: G | undefined): grouping is G;
|
|
47
|
+
/** The page is asked in group order first, then in the sort the person chose. */
|
|
48
|
+
declare function groupedPageSort(fields: readonly Field[], groupKey: string | null, sort: RecordPageSort[]): RecordPageSort[];
|
|
49
|
+
/** Every summary the store answers (`custom.record_aggregate`); a chosen summary outside it is never sent. */
|
|
50
|
+
declare const SUMMARY_OPERATIONS: readonly AggregateOperation[];
|
|
51
|
+
/** Every group's count and each chosen summary: `record_aggregate`'s measures when grouped by the grouping column. */
|
|
52
|
+
declare function groupFactMeasures(chosen: Record<string, string>): AggregateMeasure[];
|
|
53
|
+
/** The summary bar's measures over the whole table: none when nothing is chosen. */
|
|
54
|
+
declare function summaryBarMeasures(chosen: Record<string, string>): AggregateMeasure[];
|
|
55
|
+
/** The keys of the choice columns, in the table's field order: each has a header filter list with counts. */
|
|
56
|
+
declare function choiceFieldKeys(fields: readonly Field[]): string[];
|
|
57
|
+
/** How many links a grid cell draws of a reverse column (the chips; the rest is "+N"). */
|
|
58
|
+
declare const REVERSE_CELL_CHIPS = 3;
|
|
59
|
+
/**
|
|
60
|
+
* THE VIEW'S OWN QUESTION, as the grid asks it: its Rule, else its flat filter (an empty flat filter is none).
|
|
61
|
+
* The grid's column filters are laid over this by records-ui's `storeQuestion`; with none, this is the question.
|
|
62
|
+
*/
|
|
63
|
+
declare function viewFilterOf(shown: {
|
|
64
|
+
where?: StoreFilter | null | undefined;
|
|
65
|
+
filters?: StoreFilter | null | undefined;
|
|
66
|
+
} | null, _fields?: readonly Field[]): StoreFilter | undefined;
|
|
67
|
+
|
|
68
|
+
/** The table page's own page size (100 unless embedded). */
|
|
69
|
+
declare const TABLE_PAGE_SIZE = 100;
|
|
70
|
+
/** How many rows an embedded table reads at a time: its first page, and each "Show more". */
|
|
71
|
+
declare const EMBEDDED_PAGE_SIZE = 50;
|
|
72
|
+
interface FirstGridPageArgs {
|
|
73
|
+
p_table_id: Uuid;
|
|
74
|
+
p_filter: StoreFilter | Record<string, never>;
|
|
75
|
+
p_search: null;
|
|
76
|
+
p_sort: RecordPageSort[];
|
|
77
|
+
p_view_id: null;
|
|
78
|
+
p_limit: number;
|
|
79
|
+
p_offset: 0;
|
|
80
|
+
}
|
|
81
|
+
/** The request for the plain opening, from what the screen itself reads — or null. Pure. */
|
|
82
|
+
declare function firstGridPageArgs<P = ViewPresentationDocument>(input: {
|
|
83
|
+
tableId: Uuid;
|
|
84
|
+
table: Pick<Table, "default_sort"> | null;
|
|
85
|
+
fields: readonly Field[];
|
|
86
|
+
/** The view as THIS person sees it (the saved view with her look over it), or null for none. */
|
|
87
|
+
shown: SavedView<P> | null;
|
|
88
|
+
pageSize?: number;
|
|
89
|
+
/**
|
|
90
|
+
* The host draws the MERGED grid, which keeps a plain grouping as rows under group headers: the page is then
|
|
91
|
+
* read in group order. The classic grid opens the drill for a grouped view, so a grouped view stays unseeded.
|
|
92
|
+
*/
|
|
93
|
+
merged?: boolean;
|
|
94
|
+
}): FirstGridPageArgs | null;
|
|
95
|
+
type OpeningOptions<P> = {
|
|
96
|
+
pageSize?: number;
|
|
97
|
+
merged?: boolean;
|
|
98
|
+
view?: SavedViewSpec<P> | undefined;
|
|
99
|
+
codec?: ViewPresentationCodec<P>;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Read what the screen reads (through `client`, e.g. one served from `custom.table_page_bundle`) and build the first
|
|
103
|
+
* page's request. Null when anything it needs is not answered.
|
|
104
|
+
*/
|
|
105
|
+
declare function firstGridPageRequest<P = ViewPresentationDocument>(client: Pick<RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: Uuid, options?: Omit<OpeningOptions<P>, "view">): Promise<FirstGridPageArgs | null>;
|
|
106
|
+
/**
|
|
107
|
+
* THE PERSON'S SERVER-ROWS KNOBS, FROM THE TABLE'S BUNDLE: `custom.table_page_bundle` carries a `server_rows` part
|
|
108
|
+
* (whether the page may wait for the server's rows, and for how long) resolved for the person asking. Null when the
|
|
109
|
+
* seed holds no such answer (an older store, a refused part): the host treats that as off.
|
|
110
|
+
*/
|
|
111
|
+
declare function serverRowsOf(seed: RecordsSeed | null | undefined): {
|
|
112
|
+
on: boolean;
|
|
113
|
+
capMs: number | null;
|
|
114
|
+
} | null;
|
|
115
|
+
/**
|
|
116
|
+
* A TABLE PAGE'S SEED, ASKED BY THE SERVER AS THE PERSON.
|
|
117
|
+
*
|
|
118
|
+
* Asks what the table page opens on — the table's bundle, the grid's first page when it can be predicted, and on a
|
|
119
|
+
* record page the record's bundle — through a recording data source, and answers every door answer it got as a
|
|
120
|
+
* `RecordsSeed`. The host hands that to `<RecordsSeedProvider>` (`@ai-matrx/records/react`) above the table page.
|
|
121
|
+
* `dataSource` is the person's own (a server Supabase client carrying her session). Never throws.
|
|
122
|
+
*/
|
|
123
|
+
declare function askTablePageSeed<P = ViewPresentationDocument>(input: {
|
|
124
|
+
dataSource: unknown;
|
|
125
|
+
organizationId: Uuid;
|
|
126
|
+
tableId: Uuid;
|
|
127
|
+
actor: RecordsConfig["actor"];
|
|
128
|
+
/** A record page: its record's bundle (`custom.record_page_bundle`) is asked beside the table's. */
|
|
129
|
+
recordId?: Uuid | null;
|
|
130
|
+
/**
|
|
131
|
+
* Ask the grid's first page (default true). A function decides once the table's bundle has been answered — it is
|
|
132
|
+
* handed everything asked so far, so a host can read the person's `server_rows` knob (`serverRowsOf`) first.
|
|
133
|
+
*/
|
|
134
|
+
rows?: boolean | ((asked: RecordsSeed) => boolean);
|
|
135
|
+
/** The table is drawn EMBEDDED: its page size. */
|
|
136
|
+
embedded?: boolean;
|
|
137
|
+
pageSize?: number;
|
|
138
|
+
/** The host draws the merged grid: a view grouped by one field is seeded too (group counts, summary bar, link words). */
|
|
139
|
+
merged?: boolean;
|
|
140
|
+
/** THE VIEW THE HOST HANDS THE GRID, for a table with no saved view behind it. */
|
|
141
|
+
view?: SavedViewSpec<P> | undefined;
|
|
142
|
+
/** The host's view codec (records-ui binds its grid look). Left out: the plain document. */
|
|
143
|
+
codec?: ViewPresentationCodec<P>;
|
|
144
|
+
}): Promise<RecordsSeed>;
|
|
145
|
+
type Base = {
|
|
146
|
+
dataSource: unknown;
|
|
147
|
+
organizationId: Uuid;
|
|
148
|
+
actor: RecordsConfig["actor"];
|
|
149
|
+
};
|
|
150
|
+
/** A standard source's first read: its page size and the viewer's search (an empty search is none). */
|
|
151
|
+
declare function entityTableQuery(options?: {
|
|
152
|
+
pageSize?: number | undefined;
|
|
153
|
+
search?: string | null | undefined;
|
|
154
|
+
}): Query;
|
|
155
|
+
/** The block's own props that decide a chart's question. */
|
|
156
|
+
interface EntityChartQuestionInput {
|
|
157
|
+
/** The Dimension to group by. Absent: one total. */
|
|
158
|
+
by?: string | undefined;
|
|
159
|
+
/** What to count: the rows (default) or a number column summed. */
|
|
160
|
+
measure?: {
|
|
161
|
+
op: "count";
|
|
162
|
+
} | {
|
|
163
|
+
op: "sum" | "avg" | "min" | "max";
|
|
164
|
+
of: string;
|
|
165
|
+
} | undefined;
|
|
166
|
+
where?: Record<string, unknown> | undefined;
|
|
167
|
+
organization?: string | undefined;
|
|
168
|
+
}
|
|
169
|
+
/** The chart's `platform.drill_ask` question. */
|
|
170
|
+
declare function entityChartQuestion(input: EntityChartQuestionInput): DrillQuestion & {
|
|
171
|
+
organization?: string;
|
|
172
|
+
};
|
|
173
|
+
/** Several seeds as one: the later answer wins on the same door and arguments; `at` is the oldest. */
|
|
174
|
+
declare function mergeSeeds(...seeds: Array<RecordsSeed | null | undefined>): RecordsSeed;
|
|
175
|
+
/**
|
|
176
|
+
* AN ENTITY SOURCE'S BLOCK (a table, board or card of "task", "project", "crm_deal"): its columns and first page,
|
|
177
|
+
* asked through the entity engine's own port with the question the block's `useEntityTable` sends. Never throws.
|
|
178
|
+
*/
|
|
179
|
+
declare function askEntityBlockSeed(input: Base & {
|
|
180
|
+
token: string;
|
|
181
|
+
question?: {
|
|
182
|
+
pageSize?: number | undefined;
|
|
183
|
+
search?: string | null | undefined;
|
|
184
|
+
};
|
|
185
|
+
}): Promise<RecordsSeed>;
|
|
186
|
+
/** AN ENTITY SOURCE'S CHART: `platform.drill_ask` with the question the block sends. */
|
|
187
|
+
declare function askChartSeed(input: Base & {
|
|
188
|
+
source: {
|
|
189
|
+
kind: "entity";
|
|
190
|
+
token: string;
|
|
191
|
+
};
|
|
192
|
+
question?: EntityChartQuestionInput;
|
|
193
|
+
}): Promise<RecordsSeed>;
|
|
194
|
+
/** One aggregate question of a tile: `client.recordAggregate`'s arguments but the table. */
|
|
195
|
+
type TileSpec = Omit<Parameters<RecordsClient["recordAggregate"]>[0], "table_id">;
|
|
196
|
+
/** A TABLE'S TILE: `custom.record_aggregate` over `tableId` for each `spec`. Read back with `useSeededAggregate`. */
|
|
197
|
+
declare function askTileSeed(input: Base & {
|
|
198
|
+
tableId: Uuid;
|
|
199
|
+
spec: TileSpec | TileSpec[];
|
|
200
|
+
}): Promise<RecordsSeed>;
|
|
201
|
+
/**
|
|
202
|
+
* THE FIRST PAGE WITH A HOST'S VIEW CODEC BOUND ONCE (records-ui binds its grid look): the host re-exports these
|
|
203
|
+
* under the same names — bindings of the one definition here, never a second body.
|
|
204
|
+
*/
|
|
205
|
+
declare function bindFirstPageCodec<P>(codec: ViewPresentationCodec<P>): {
|
|
206
|
+
firstGridPageRequest: (client: Pick<RecordsClient, "tableRead" | "fields" | "views" | "viewLookRead">, tableId: Uuid, options?: {
|
|
207
|
+
pageSize?: number;
|
|
208
|
+
merged?: boolean;
|
|
209
|
+
}) => Promise<FirstGridPageArgs | null>;
|
|
210
|
+
askTablePageSeed: (input: Omit<Parameters<typeof askTablePageSeed<P>>[0], "codec">) => Promise<RecordsSeed>;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export { type ColumnSort, EMBEDDED_PAGE_SIZE, type EntityChartQuestionInput, type FirstGridPageArgs, type GroupingShape, REVERSE_CELL_CHIPS, SUMMARY_OPERATIONS, TABLE_PAGE_SIZE, type TileSpec, askChartSeed, askEntityBlockSeed, askTablePageSeed, askTileSeed, bindFirstPageCodec, choiceFieldKeys, defaultSortOf, entityChartQuestion, entityTableQuery, firstGridPageArgs, firstGridPageRequest, groupFactMeasures, groupedPageSort, holdsNumbers, isPlainGrouping, mergeSeeds, pageSortFor, serverRowsOf, sortAsFor, summaryBarMeasures, viewFilterOf };
|