@mistriwork/engine 1.0.0-rc.47 → 1.0.0-rc.49

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,7 +1,8 @@
1
1
  import { ANSI_STYLE, Refusal } from '../adapter.js';
2
2
  import { cachedStatement as prepared } from '../sqliteHandles.js';
3
- import { chooseColumnReference, deleteRuleOf, } from '../../shared/schema.js';
3
+ import { chooseColumnReference, columnKind, deleteRuleOf, } from '../../shared/schema.js';
4
4
  import { mapScopeCatalog } from '../../shared/scopeCatalog.js';
5
+ import { flagsFromDDL, vocabularyFromDDL } from '../../shared/vocabulary.js';
5
6
  import { referenceKey } from './scopedTransaction.js';
6
7
  import { keyTypeRefusal, sqliteAffinity, sqliteKeyType, sqliteTypeSaid } from './keyTypes.js';
7
8
  import { readSqliteTrigger, sqliteColumnCollations, sqliteConflictClauses } from './sqliteTriggers.js';
@@ -217,7 +218,7 @@ function scanSqliteScopeCatalog(db) {
217
218
  try {
218
219
  if (prepared(db, 'PRAGMA foreign_keys').get()?.foreign_keys !== 1)
219
220
  return refuse();
220
- const entries = prepared(db, "SELECT name, type FROM main.sqlite_schema WHERE type IN ('table', 'view') ORDER BY name").all();
221
+ const entries = prepared(db, "SELECT name, type, sql FROM main.sqlite_schema WHERE type IN ('table', 'view') ORDER BY name").all();
221
222
  const listed = prepared(db, 'PRAGMA main.table_list').all();
222
223
  // Unknown PRAGMAs can return nothing without throwing. Never interpret
223
224
  // unavailable table-kind metadata as proof that a table is ordinary.
@@ -283,6 +284,12 @@ function scanSqliteScopeCatalog(db) {
283
284
  !indexes.some((index) => index.origin === 'pk')
284
285
  ? primary[0].name
285
286
  : undefined;
287
+ /* A CHECK's vocabulary and a 0-or-1 flag, read off the statement as the browser's catalog reads them (sqlite.ts):
288
+ evidence of how a value reads, never a grant (scopeCatalog.ts leaves both out of the fingerprint). A tenant
289
+ App judges a menu's `when` over its profile by them (appTenantProfile.ts menuFor), as check did. */
290
+ const names = columns.map((column) => column.name);
291
+ const vocabulary = typeof entry.sql === 'string' ? vocabularyFromDDL(entry.sql, names) : new Map();
292
+ const flags = typeof entry.sql === 'string' ? flagsFromDDL(entry.sql, names) : new Set();
286
293
  tables.push({
287
294
  id: entry.name,
288
295
  name: entry.name,
@@ -295,6 +302,8 @@ function scanSqliteScopeCatalog(db) {
295
302
  nullable: column.notnull === 0 && column.name !== identity && !(column.pk > 0 && (kind.wr === 1 || kind.strict === 1)),
296
303
  ...(column.dflt_value !== null ? { default: column.dflt_value } : {}),
297
304
  ...(column.name === identity ? { identity: 'by-default' } : {}),
305
+ ...(vocabulary.has(column.name) ? { allowed: vocabulary.get(column.name) } : {}),
306
+ ...(flags.has(column.name) && columnKind(column.type) === 'number' ? { flag: true } : {}),
298
307
  // The database computes a generated column from its row: read like any other, never written.
299
308
  ...(generated(column) ? { writable: false } : {}),
300
309
  })),
@@ -17,7 +17,7 @@ import { CONFIG_PAGE_RENAMED, CUSTOM_SECTION_RENAMED, LINK_INTENT_RENAMED, SECTI
17
17
  import { parseSortText } from './sortText.js';
18
18
  import { componentPropValues, parseComponentDecl, parsePageReads, parsePageTotals, parseRecordFields } from './appComponents.js';
19
19
  import { parseAppLinkAction, parseAppTarget, parseLinkTo } from './appLinks.js';
20
- import { WIDTHS, OFFSETS, SECTION_REGIONS, FIELD_COLUMNS, MAX_STREAMS, MAX_HISTORY_LIMIT, MAX_SECTIONS, MAX_PAGE_SECTIONS, screenSections, GROUPS_MOST, GROUP_ROWS_MOST, } from './pageModel.js';
20
+ import { WIDTHS, OFFSETS, SECTION_REGIONS, FIELD_COLUMNS, MAX_STREAMS, MAX_HISTORY_LIMIT, MAX_SECTIONS, MAX_PAGE_SECTIONS, screenSections, screenSectionsSaid, GROUPS_MOST, GROUP_ROWS_MOST, } from './pageModel.js';
21
21
  /* ---------- config ---------- */
22
22
  /**
23
23
  * Read the `pages` section of a tablewalk.json.
@@ -209,7 +209,8 @@ function parseSections(raw, at, name, config) {
209
209
  const drawn = screenSections(sections);
210
210
  if (drawn > MAX_SECTIONS) {
211
211
  throw new Error(`${at} ("${name}") has more than ${MAX_SECTIONS} sections on one screen (${drawn}). A page is a screen, not a report: ` +
212
- 'give some of them a "tab", and each tab is counted as a screen of its own.');
212
+ `a screen counts the sections in no tab plus its fullest tab's, in each region (here ${screenSectionsSaid(sections)}), ` +
213
+ 'so give some of them a "tab", and each tab is counted as a screen of its own.');
213
214
  }
214
215
  /* A record has one head. */
215
216
  if (sections.filter((s) => s.kind === 'fields' && s.presentation === 'header').length > 1) {
@@ -855,6 +855,11 @@ export declare function screenSections(sections: readonly {
855
855
  region?: SectionRegion;
856
856
  tab?: string;
857
857
  }[]): number;
858
+ /** How that count is made, for the sentence that refuses a page over the ceiling: "main 18 in no tab + 6 in its fullest tab". */
859
+ export declare function screenSectionsSaid(sections: readonly {
860
+ region?: SectionRegion;
861
+ tab?: string;
862
+ }[]): string;
858
863
  /** A workflow step's label when it names none: `in_review` reads "In review". */
859
864
  export declare function workflowLabel(value: string): string;
860
865
  export {};
@@ -105,8 +105,8 @@ export const HISTORY_TAB = 'history';
105
105
  export const MAX_SECTIONS = 24;
106
106
  /** Sections a page may hold in all, every tab's included. */
107
107
  export const MAX_PAGE_SECTIONS = 96;
108
- /** How many sections a page draws on its fullest screen: per region, those in no tab and its largest tab's. */
109
- export function screenSections(sections) {
108
+ /** Per region, the sections in no tab and the fullest tab's: what one screen of the page draws. */
109
+ function screenCounts(sections) {
110
110
  const regions = new Map();
111
111
  for (const section of sections) {
112
112
  const region = section.region ?? 'main';
@@ -117,11 +117,21 @@ export function screenSections(sections) {
117
117
  else
118
118
  counted.tabs.set(section.tab, (counted.tabs.get(section.tab) ?? 0) + 1);
119
119
  }
120
+ return new Map([...regions].map(([region, { untabbed, tabs }]) => [region, { untabbed, fullest: Math.max(0, ...tabs.values()) }]));
121
+ }
122
+ /** How many sections a page draws on its fullest screen: per region, those in no tab and its largest tab's. */
123
+ export function screenSections(sections) {
120
124
  let most = 0;
121
- for (const { untabbed, tabs } of regions.values())
122
- most += untabbed + Math.max(0, ...tabs.values());
125
+ for (const { untabbed, fullest } of screenCounts(sections).values())
126
+ most += untabbed + fullest;
123
127
  return most;
124
128
  }
129
+ /** How that count is made, for the sentence that refuses a page over the ceiling: "main 18 in no tab + 6 in its fullest tab". */
130
+ export function screenSectionsSaid(sections) {
131
+ return [...screenCounts(sections)]
132
+ .map(([region, { untabbed, fullest }]) => `${region} ${untabbed} in no tab${fullest ? ` + ${fullest} in its fullest tab` : ''}`)
133
+ .join(', ');
134
+ }
125
135
  /** A workflow step's label when it names none: `in_review` reads "In review". */
126
136
  export function workflowLabel(value) {
127
137
  const words = value.replaceAll('_', ' ');
@@ -129,7 +129,7 @@ export declare function expandSegments(text: string, segments: Readonly<Record<s
129
129
  */
130
130
  export declare function quoteValue(value: unknown): string;
131
131
  export type { QueryPerson } from './queryOperands.js';
132
- export { ANYONE } from './queryOperands.js';
132
+ export { ANYONE, ANYONE_ONCE } from './queryOperands.js';
133
133
  interface ParseOptions {
134
134
  schema?: DatabaseSchema;
135
135
  /** Injected so compilation is deterministic and testable. */
@@ -4,7 +4,7 @@ import { distance, nearest } from './suggest.js';
4
4
  import { columnKind, findTable } from './schema.js';
5
5
  import { dateWindow } from './queryDates.js';
6
6
  import { maskQuoted } from './maskQuoted.js';
7
- import { ME_SET, columnOperand, meOperand, meSetOperand, tenantOperand } from './queryOperands.js';
7
+ import { ME_SET, TENANT_FIELD, columnOperand, meOperand, meSetOperand, tenantHolds, tenantOperand, } from './queryOperands.js';
8
8
  import { TAGS_TYPE } from './tagLists.js';
9
9
  import { DEFINED_PATH_TYPE } from './definedFields.js';
10
10
  const RANGE_OPS = new Set(['<', '<=', '>', '>=']);
@@ -600,16 +600,61 @@ function resolveColumn(table, name) {
600
600
  const suggestion = near ? ` Did you mean "${near}"?` : '';
601
601
  return { error: `"${name}" is not a column on ${table.name}.${suggestion}` };
602
602
  }
603
- export { ANYONE } from './queryOperands.js';
603
+ export { ANYONE, ANYONE_ONCE } from './queryOperands.js';
604
604
  /* A record's tags are asked only whether they hold a label: `tags = bug` would
605
605
  compare the list itself, which is no question anyone means. */
606
606
  function compileCondition(raw, ctx) {
607
+ const constant = tenantClause(raw.trim(), ctx);
608
+ if (constant)
609
+ return constant;
607
610
  const compiled = compileClause(raw, ctx);
608
611
  const tagged = compiled.conditions?.find((c) => c.op !== 'has' && ctx.table?.columns.find((col) => col.name === c.column)?.type === TAGS_TYPE);
609
612
  if (tagged)
610
613
  return { error: `"${tagged.column}" is a record's tags: ask it with has, as in ${tagged.column} has bug.` };
611
614
  return compiled;
612
615
  }
616
+ /**
617
+ * A condition on the reader's tenant (`tenant.plan = 'pro'`, `tenant.plan in (pro, team)`, `tenant.plan is empty`),
618
+ * judged for this request (queryOperands.ts tenantHolds): one that holds says `holds`, and its group asks nothing
619
+ * more of the row; one that does not is a condition no row meets. Undefined where the left is not that word: a
620
+ * table with a `tenant` column of its own, or a path the view parser found (`tenant.plan` through a reference).
621
+ */
622
+ function tenantClause(text, ctx) {
623
+ const table = ctx.table;
624
+ const field = /^([\w.$+]+)/.exec(text)?.[1];
625
+ if (!table || !field || !TENANT_FIELD.test(field) || table.columns.some((c) => c.name === 'tenant') || !resolveColumn(table, field).error)
626
+ return undefined;
627
+ const rest = text.slice(field.length);
628
+ let judged;
629
+ const empty = /^\s+is\s+(not\s+)?empty$/i.exec(rest);
630
+ const listed = /^\s+(not\s+in|in)\s+(.+)$/i.exec(rest);
631
+ const symbol = /^\s*(!=|<=|>=|=|<|>)\s*(.+)$/.exec(rest);
632
+ if (empty)
633
+ judged = tenantHolds(ctx, field, empty[1] ? 'isNotNull' : 'isNull', []);
634
+ else if (listed) {
635
+ const items = listed[2]
636
+ .trim()
637
+ .replace(/^[([]\s*/, '')
638
+ .replace(/\s*[)\]]$/, '')
639
+ .split(',')
640
+ .map((s) => unquoteValue(s))
641
+ .filter((s) => s.value !== '');
642
+ if (!items.length)
643
+ return { error: `"${listed[1]}" needs at least one value` };
644
+ judged = tenantHolds(ctx, field, /^not/i.test(listed[1]) ? 'not in' : 'in', items);
645
+ }
646
+ else if (symbol)
647
+ judged = tenantHolds(ctx, field, symbol[1], [unquoteValue(symbol[2])]);
648
+ else
649
+ return { error: `${field} is the reader's tenant: ask it with =, !=, <, >, in or is empty, as in ${field} = 'pro'.` };
650
+ if (judged.error)
651
+ return { error: judged.error };
652
+ if (judged.holds)
653
+ return { conditions: [], holds: true };
654
+ /* No row: an empty list, which every engine says as a falsehood (filter.ts `never`), over a column every read has. */
655
+ const key = table.columns.find((c) => c.primaryKey) ?? table.columns[0];
656
+ return { conditions: [{ column: key.name, op: 'in', value: [] }] };
657
+ }
613
658
  function compileClause(raw, ctx) {
614
659
  const { table, now } = ctx;
615
660
  const text = raw.trim();
@@ -1191,26 +1236,39 @@ function parseUncached(input, options) {
1191
1236
  errors.push({ message: `That expands to more than ${MAX_GROUPS} OR branches. Simplify it or filter in two steps.` });
1192
1237
  }
1193
1238
  else {
1239
+ /* A group whose every condition is the reader's tenant, and holds (`tenant.plan = 'pro'`), asks nothing of the
1240
+ row: every row is in it, so the filter is every row, whatever the other branches ask. */
1241
+ let everything = false;
1194
1242
  for (const group of groups) {
1195
1243
  const conditions = [];
1244
+ let held = 0;
1245
+ let failed = false;
1196
1246
  for (const node of group) {
1197
1247
  if (node.kind !== 'cond')
1198
1248
  continue;
1199
- const { conditions: got, error } = compileCondition(node.text, {
1249
+ const { conditions: got, error, holds, } = compileCondition(node.text, {
1200
1250
  table,
1201
1251
  now,
1202
1252
  columnValues: options.columnValues === true,
1203
1253
  ...(options.me !== undefined ? { me: options.me } : {}),
1204
1254
  ...(options.states ? { states: options.states } : {}),
1205
1255
  });
1206
- if (error)
1256
+ if (error) {
1207
1257
  errors.push({ message: error, at: said(node.at) });
1258
+ failed = true;
1259
+ }
1208
1260
  else if (got)
1209
1261
  conditions.push(...got);
1262
+ if (holds)
1263
+ held++;
1210
1264
  }
1211
1265
  if (conditions.length)
1212
1266
  filter.groups.push(conditions);
1267
+ else if (held && !failed)
1268
+ everything = true;
1213
1269
  }
1270
+ if (everything)
1271
+ filter.groups = [];
1214
1272
  }
1215
1273
  }
1216
1274
  const orderBy = [];
@@ -24,6 +24,12 @@ export interface QueryPerson {
24
24
  * read as no one's, so a segment about the person is judged by the rest of what it says.
25
25
  */
26
26
  anyone?: true;
27
+ /**
28
+ * With `anyone`: the query is compiled once and kept for every request (a rollup's rows), so a fact of one
29
+ * request, `tenant.<column>`, cannot be read into it. Held for `anyone` alone, as a check before any request
30
+ * does; here refused, since a figure that held it for everyone would count every row.
31
+ */
32
+ once?: true;
27
33
  /**
28
34
  * The table people are rows of (an App's `auth.me`), and the signed-in
29
35
  * account's row key there — null when no row carries their email, which
@@ -53,6 +59,8 @@ export interface QueryPerson {
53
59
  export type TenantValue = string | number | boolean | null;
54
60
  /** Nobody in particular (`anyone` above): what a check that runs before any request reads `me` as. */
55
61
  export declare const ANYONE: QueryPerson;
62
+ /** ANYONE for a query kept as it is compiled and served to every request: `tenant.<column>` is refused, not held. */
63
+ export declare const ANYONE_ONCE: QueryPerson;
56
64
  /** One `me.<table>.<column>`: its values and their kind, or the sentence that refuses it. */
57
65
  export type MeSet = {
58
66
  values: readonly (string | number)[];
@@ -71,6 +79,25 @@ export interface CompileContext {
71
79
  /** A machine's states by column, where the catalog does not carry them (a parse with no schema). */
72
80
  states?: Readonly<Record<string, MachineStates>>;
73
81
  }
82
+ /** `tenant.<column>` where a condition's left-hand column would be. */
83
+ export declare const TENANT_FIELD: RegExp;
84
+ /** How a condition with `tenant.<column>` on its left compares (`tenant.plan = 'pro'`, `tenant.plan in (pro, team)`). */
85
+ export type TenantTest = '=' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not in' | 'isNull' | 'isNotNull';
86
+ /**
87
+ * `tenant.<column>` on the left of a condition (`tenant.plan = 'pro'`): no column of the row but a fact of this
88
+ * request, as a menu's or a command input's `when` reads it (commandWhen.ts foldWhen), so the condition holds of
89
+ * every row or of none. Judged against the profile as that fold judges it: a null value meets only `is empty`, and
90
+ * a value written is read as the profile's kind (a number, a flag, text). Refused with the words the right-hand
91
+ * form uses where no tenant is meant or the column is not shared. A check before any request (ANYONE) holds it,
92
+ * and the request judges it.
93
+ */
94
+ export declare function tenantHolds(ctx: CompileContext, word: string, test: TenantTest, values: readonly {
95
+ value: string;
96
+ quoted: boolean;
97
+ }[]): {
98
+ holds?: boolean;
99
+ error?: string;
100
+ };
74
101
  /**
75
102
  * What `tenant.<column>` stands for beside one column: the profile's value, read for
76
103
  * this request. Undefined where the word is not one (quoted, or the table has a
@@ -3,8 +3,62 @@ import { columnKind } from './schema.js';
3
3
  const TENANT_VALUE = /^tenant\.([A-Za-z_]\w*)$/;
4
4
  /** Nobody in particular (`anyone` above): what a check that runs before any request reads `me` as. */
5
5
  export const ANYONE = Object.freeze({ email: null, anyone: true });
6
+ /** ANYONE for a query kept as it is compiled and served to every request: `tenant.<column>` is refused, not held. */
7
+ export const ANYONE_ONCE = Object.freeze({ email: null, anyone: true, once: true });
8
+ const ONCE_TENANT = (word) => `${word} is a fact of one request's tenant, and this query is read once for every request, so it cannot ask it. Test the tenant in a \`when\` instead.`;
6
9
  /** `me.<table>.<column>`, written as one item of a value list. */
7
10
  export const ME_SET = /^me\.([A-Za-z_]\w*)\.([A-Za-z_]\w*)$/;
11
+ /** `tenant.<column>` where a condition's left-hand column would be. */
12
+ export const TENANT_FIELD = TENANT_VALUE;
13
+ /**
14
+ * `tenant.<column>` on the left of a condition (`tenant.plan = 'pro'`): no column of the row but a fact of this
15
+ * request, as a menu's or a command input's `when` reads it (commandWhen.ts foldWhen), so the condition holds of
16
+ * every row or of none. Judged against the profile as that fold judges it: a null value meets only `is empty`, and
17
+ * a value written is read as the profile's kind (a number, a flag, text). Refused with the words the right-hand
18
+ * form uses where no tenant is meant or the column is not shared. A check before any request (ANYONE) holds it,
19
+ * and the request judges it.
20
+ */
21
+ export function tenantHolds(ctx, word, test, values) {
22
+ const column = TENANT_VALUE.exec(word)[1];
23
+ const me = ctx.me;
24
+ if (me?.anyone && me.tenant === undefined)
25
+ return me.once ? { error: ONCE_TENANT(word) } : { holds: true };
26
+ if (!me?.tenant)
27
+ return { error: `${word} is the reader's tenant profile, and no tenant is meant here. Quote it ("${word}") to mean the text.` };
28
+ if (!Object.hasOwn(me.tenant, column))
29
+ return { error: `${word} is not a column the App shares with its members: list "${column}" in auth.tenancy.shared.` };
30
+ for (const { value, quoted } of values) {
31
+ if (!quoted && (value === 'me' || ME_SET.test(value) || TENANT_VALUE.test(value) || ctx.table?.columns.some((c) => c.name === value)))
32
+ return { error: `${word} is compared with a value, and ${value} is not one. Quote it ("${value}") to mean the text.` };
33
+ }
34
+ const held = me.tenant[column];
35
+ if (test === 'isNull')
36
+ return { holds: held === null };
37
+ if (test === 'isNotNull')
38
+ return { holds: held !== null };
39
+ if (held === null)
40
+ return { holds: false };
41
+ const as = (given) => typeof held === 'number' ? Number(given) : typeof held === 'boolean' ? /^(1|true|t|yes|y)$/i.test(given) : given;
42
+ const read = values.map((item) => as(item.value));
43
+ switch (test) {
44
+ case 'in':
45
+ return { holds: read.includes(held) };
46
+ case 'not in':
47
+ return { holds: !read.includes(held) };
48
+ case '=':
49
+ return { holds: held === read[0] };
50
+ case '!=':
51
+ return { holds: held !== read[0] };
52
+ case '<':
53
+ return { holds: held < read[0] };
54
+ case '<=':
55
+ return { holds: held <= read[0] };
56
+ case '>':
57
+ return { holds: held > read[0] };
58
+ case '>=':
59
+ return { holds: held >= read[0] };
60
+ }
61
+ }
8
62
  /**
9
63
  * What `tenant.<column>` stands for beside one column: the profile's value, read for
10
64
  * this request. Undefined where the word is not one (quoted, or the table has a
@@ -18,7 +72,7 @@ export function tenantOperand(ctx, column, word, quoted) {
18
72
  return undefined;
19
73
  const me = ctx.me;
20
74
  if (me?.anyone && me.tenant === undefined)
21
- return { value: word };
75
+ return me.once ? { error: ONCE_TENANT(word) } : { value: word };
22
76
  if (!me?.tenant)
23
77
  return { error: `${word} is the reader's tenant profile, and no tenant is meant here. Quote it ("${word}") to mean the text.` };
24
78
  if (!Object.hasOwn(me.tenant, match[1]))
@@ -38,6 +38,7 @@ import { ANSI_STYLE, buildWhere, collate, orderClauseSql, } from './filter.js';
38
38
  import { clampLimit, clampOffset, countStatement, LANE_ROW } from './reads.js';
39
39
  import { aggregateInput, declaredOrder, findTable, } from './schema.js';
40
40
  import { ANY_CONDITION, anyConditions, expandSegments, parseQuery, splitClauseTail } from './query.js';
41
+ import { TENANT_FIELD } from './queryOperands.js';
41
42
  import { stitchedListProblem } from './stitchedPaths.js';
42
43
  import { qualifiedTable } from './sqlRelation.js';
43
44
  import { ScopedRelations } from './rowScope.js';
@@ -509,6 +510,10 @@ export function parseViewQuery(schema, baseId, text, now, options = {}) {
509
510
  added.add(path);
510
511
  const { resolved, error } = tryResolvePath(schema, baseId, path);
511
512
  if (error) {
513
+ /* `tenant.plan = 'pro'` is no path but the reader's tenant, which the parser judges for this request
514
+ (query.ts tenantClause); a table with a `tenant` column of its own reads it as the path it is. */
515
+ if (TENANT_FIELD.test(path) && !base.columns.some((c) => c.name === 'tenant'))
516
+ continue;
512
517
  /* Located at the token so the composer can underline the right word.
513
518
  The offset is into the filter text, and the caller shifts it. */
514
519
  if (isField) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/engine",
3
- "version": "1.0.0-rc.47",
3
+ "version": "1.0.0-rc.49",
4
4
  "description": "The engine both products stand on: the adapters (SQLite, Postgres), the catalog, the query language, keyset pages, the HTTP kit and the shared rules. No React.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {
package/schema/model.d.ts CHANGED
@@ -234,6 +234,9 @@ export interface AppFormCommandReference {
234
234
  label?: string;
235
235
  }
236
236
 
237
+ /** As served, where every `msg()` is said, a caption is text; as authored it may be a message. */
238
+ type SubmitLabel<Label> = [Label] extends [string] ? string : string | AppMessageRef;
239
+
237
240
  export interface AppUpdateAction<Label extends string | AppMessageRef = string> {
238
241
  /** Its key in `resources.<table>.actions`: what a header, a queue and a role name it by. Served, never authored in the object. */
239
242
  id: string;
@@ -257,11 +260,19 @@ export interface AppUpdateAction<Label extends string | AppMessageRef = string>
257
260
  bulk?: boolean;
258
261
  /** See `CommandActionBase.header`. */
259
262
  header?: boolean;
263
+ /** The words on the button of the dialog this action opens (the confirmation, the reason), at most 60 characters; left
264
+ out, the action's own label. A label that reads right as a button on the record (a noun) may read wrong as the
265
+ dialog's submit, which is an instruction. */
266
+ submitLabel?: SubmitLabel<Label>;
260
267
  command?: never;
261
268
  }
262
269
 
263
270
  export interface CommandActionBase<Label extends string | AppMessageRef> {
264
271
  label: Label;
272
+ /** The words on the submit of the form (or the confirmation) this action opens, at most 60 characters; left out, the
273
+ action's own label. A label that reads right as a button on the record (a noun) may read wrong as the dialog's
274
+ submit, which is an instruction. */
275
+ submitLabel?: SubmitLabel<Label>;
265
276
  /** A command collects what it needs through its own input. */
266
277
  reason?: never;
267
278
  set?: never;