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

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.
@@ -117,7 +117,8 @@ export interface ComputedColumn {
117
117
  export interface ComputedPath extends ComputedColumn {
118
118
  on: string;
119
119
  }
120
- /** What a computed column is to anything that reads columns: typed, never written, never a key. */
120
+ /** What a computed column is to anything that reads columns: typed, never written, never a key. A number is said to
121
+ DERIVED_PLACES, as an average is: `minutes / 60` read 1.3333333. */
121
122
  export declare function computedColumnMeta(name: string, computed: Pick<ComputedColumn, 'type'>): ColumnMeta;
122
123
  /**
123
124
  * The catalog with each table's computed columns among its columns, typed and never written (`computed` by table id):
@@ -1,6 +1,8 @@
1
1
  import { noteRead } from './query.js';
2
+ import { DERIVED_PLACES } from './rollups.js';
2
3
  export const COMPUTED_TYPES = ['boolean', 'number', 'date', 'text'];
3
- /** What a computed column is to anything that reads columns: typed, never written, never a key. */
4
+ /** What a computed column is to anything that reads columns: typed, never written, never a key. A number is said to
5
+ DERIVED_PLACES, as an average is: `minutes / 60` read 1.3333333. */
4
6
  export function computedColumnMeta(name, computed) {
5
7
  return {
6
8
  name,
@@ -8,6 +10,7 @@ export function computedColumnMeta(name, computed) {
8
10
  nullable: computed.type !== 'boolean',
9
11
  primaryKey: false,
10
12
  writable: false,
13
+ ...(computed.type === 'number' ? { places: DERIVED_PLACES } : {}),
11
14
  };
12
15
  }
13
16
  /**
@@ -124,7 +124,10 @@ export interface Rollup {
124
124
  export interface ComputedPath extends Rollup {
125
125
  on: string;
126
126
  }
127
- /** A rollup read as a column: never written, null only where there are no rows to read (a count is 0). */
127
+ /** The most places a worked-out figure is said with: an average's, a computed number's. Two, as money reads. */
128
+ export declare const DERIVED_PLACES = 2;
129
+ /** A rollup read as a column: never written, null only where there are no rows to read (a count is 0). An average
130
+ is said to DERIVED_PLACES: of whole numbers it read "3.333" (a field report). */
128
131
  export declare function rollupColumnMeta(name: string, rollup: Pick<Rollup, 'fn' | 'type' | 'allowed' | 'references'>): ColumnMeta;
129
132
  /** A view's or a breakdown's `computed` with every child table renamed. */
130
133
  export declare function renamedComputed<T extends {
@@ -1,5 +1,8 @@
1
1
  export const ROLLUP_FNS = ['count', 'sum', 'avg', 'min', 'max', 'latest'];
2
- /** A rollup read as a column: never written, null only where there are no rows to read (a count is 0). */
2
+ /** The most places a worked-out figure is said with: an average's, a computed number's. Two, as money reads. */
3
+ export const DERIVED_PLACES = 2;
4
+ /** A rollup read as a column: never written, null only where there are no rows to read (a count is 0). An average
5
+ is said to DERIVED_PLACES: of whole numbers it read "3.333" (a field report). */
3
6
  export function rollupColumnMeta(name, rollup) {
4
7
  return {
5
8
  name,
@@ -7,6 +10,7 @@ export function rollupColumnMeta(name, rollup) {
7
10
  nullable: rollup.fn !== 'count',
8
11
  primaryKey: false,
9
12
  writable: false,
13
+ ...(rollup.fn === 'avg' ? { places: DERIVED_PLACES } : {}),
10
14
  ...(rollup.allowed ? { allowed: rollup.allowed } : {}),
11
15
  ...(rollup.references ? { references: rollup.references } : {}),
12
16
  };
@@ -41,6 +41,11 @@ export interface ColumnMeta {
41
41
  * string carries its own (`decimals.ts` declaredScale).
42
42
  */
43
43
  scale?: number;
44
+ /**
45
+ * The most places a worked-out figure is said with — an average, a computed number — whose value carries more
46
+ * than anyone reads (an average of 3, 3 and 4 is 3.333…). Said only: the value read, filtered and sorted is whole.
47
+ */
48
+ places?: number;
44
49
  /** Public presence hint when a private schema projection omits the SQL default. */
45
50
  hasDefault?: boolean;
46
51
  /** Catalog-confirmed automatic identity assignment; absent is not a type-based guess. */
@@ -720,7 +720,9 @@ export declare function navViewKeys(nav: readonly ServedNavNode[]): string[];
720
720
  * Every view key in the order rooms are listed: the menu's, then the views
721
721
  * nav does not reference (a home nav does not list, and a list view only a
722
722
  * dashboard embeds). Never the keys'
723
- * own order — an object puts a key like "2024" before every other.
723
+ * own order — an object puts a key like "2024" before every other. Each key
724
+ * once: a view or page standing in two workspaces is one room, and listed
725
+ * twice it would claim its own address a second time (appAddress.ts).
724
726
  */
725
727
  export declare function viewOrder(app: {
726
728
  views: Readonly<Record<string, unknown>>;
@@ -36,10 +36,12 @@ export function navViewKeys(nav) {
36
36
  * Every view key in the order rooms are listed: the menu's, then the views
37
37
  * nav does not reference (a home nav does not list, and a list view only a
38
38
  * dashboard embeds). Never the keys'
39
- * own order — an object puts a key like "2024" before every other.
39
+ * own order — an object puts a key like "2024" before every other. Each key
40
+ * once: a view or page standing in two workspaces is one room, and listed
41
+ * twice it would claim its own address a second time (appAddress.ts).
40
42
  */
41
43
  export function viewOrder(app) {
42
- const keys = navViewKeys(app.nav).filter((key) => Object.hasOwn(app.views, key));
44
+ const keys = [...new Set(navViewKeys(app.nav))].filter((key) => Object.hasOwn(app.views, key));
43
45
  return [...keys, ...Object.keys(app.views).filter((key) => !keys.includes(key))];
44
46
  }
45
47
  /** The assistant's own room, where its App gives it a page (`placement: 'page'`, appAssistant.ts): its word in
@@ -420,7 +420,8 @@ const CONTRAST_PAIRS = [
420
420
  ['inkSubtle', 'ground', 4.5, 'a faint caption on the page'],
421
421
  ['link', 'ground', 4.5],
422
422
  ['link', 'raised', 4.5],
423
- ['navAccent', 'navGround', 4.5, "the menu's current entry"],
423
+ // The same accent underlines the current workspace and room on the bar (visualThemes.css), so one pair measures both.
424
+ ['navAccent', 'navGround', 4.5, "the menu's current entry and the underline marking the current workspace"],
424
425
  /* The accent is a fill, and is read as text in its ink (`accentInk`, the accent itself where a theme names none and
425
426
  it reads); the words drawn on a fill are `onAccent`. A bright brand accent can be a good fill and a poor text. */
426
427
  ['accentInk', 'surface', 4.5],
@@ -430,8 +431,8 @@ const CONTRAST_PAIRS = [
430
431
  ['onAccent', 'accent', 4.5, 'the words on an accent fill'],
431
432
  ['onPrimary', 'primary', 4.5, "the words on a form's primary action"],
432
433
  ['link', 'surface', 4.5],
433
- ['navInk', 'navGround', 4.5, "the menu's entries"],
434
- ['navMuted', 'navGround', 4.5, "the menu's group headings, counts and icons"],
434
+ ['navInk', 'navGround', 4.5, "the menu's entries and the current workspace"],
435
+ ['navMuted', 'navGround', 4.5, "the menu's group headings, counts and icons, and the other workspaces"],
435
436
  ...['statusGood', 'statusWarning', 'statusCritical', 'statusInfo'].flatMap((role) => [
436
437
  [role, 'surface', 4.5],
437
438
  [role, 'ground', 4.5],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/engine",
3
- "version": "1.0.0-rc.46",
3
+ "version": "1.0.0-rc.47",
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": {