@adminiumjs/manifest 0.3.26 → 0.3.28
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/dist/app-grants.d.ts +134 -0
- package/dist/app-grants.d.ts.map +1 -0
- package/dist/app-grants.js +263 -0
- package/dist/app-grants.js.map +1 -0
- package/dist/automations.d.ts +2172 -56
- package/dist/automations.d.ts.map +1 -1
- package/dist/automations.js +438 -25
- package/dist/automations.js.map +1 -1
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +3 -0
- package/dist/compose.js.map +1 -1
- package/dist/documents.d.ts +1 -0
- package/dist/documents.d.ts.map +1 -1
- package/dist/documents.js +2 -0
- package/dist/documents.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/ledgers.d.ts.map +1 -1
- package/dist/ledgers.js +2 -0
- package/dist/ledgers.js.map +1 -1
- package/dist/modules.d.ts +93 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +489 -0
- package/dist/modules.js.map +1 -0
- package/dist/occupies.d.ts +50 -0
- package/dist/occupies.d.ts.map +1 -0
- package/dist/occupies.js +123 -0
- package/dist/occupies.js.map +1 -0
- package/dist/outbox.d.ts +223 -17
- package/dist/outbox.d.ts.map +1 -1
- package/dist/outbox.js +125 -13
- package/dist/outbox.js.map +1 -1
- package/dist/page-board.d.ts +144 -0
- package/dist/page-board.d.ts.map +1 -0
- package/dist/page-board.js +280 -0
- package/dist/page-board.js.map +1 -0
- package/dist/public-access.d.ts +6 -0
- package/dist/public-access.d.ts.map +1 -1
- package/dist/public-access.js +74 -0
- package/dist/public-access.js.map +1 -1
- package/dist/rail.d.ts +50 -0
- package/dist/rail.d.ts.map +1 -0
- package/dist/rail.js +122 -0
- package/dist/rail.js.map +1 -0
- package/dist/roles.d.ts +647 -1
- package/dist/roles.d.ts.map +1 -1
- package/dist/roles.js +459 -3
- package/dist/roles.js.map +1 -1
- package/dist/sample.d.ts +62 -0
- package/dist/sample.d.ts.map +1 -1
- package/dist/sample.js +203 -4
- package/dist/sample.js.map +1 -1
- package/dist/schema.d.ts +4277 -169
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +539 -40
- package/dist/schema.js.map +1 -1
- package/dist/shapes.d.ts +3 -2
- package/dist/shapes.d.ts.map +1 -1
- package/dist/shapes.js +76 -7
- package/dist/shapes.js.map +1 -1
- package/dist/state-actions.d.ts +4 -0
- package/dist/state-actions.d.ts.map +1 -1
- package/dist/state-actions.js +7 -0
- package/dist/state-actions.js.map +1 -1
- package/dist/states.d.ts +20 -1
- package/dist/states.d.ts.map +1 -1
- package/dist/states.js +47 -5
- package/dist/states.js.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +41 -0
- package/dist/validate.js.map +1 -1
- package/dist/words.d.ts +1 -1
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +328 -1
- package/dist/words.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A board page's columns: `config.board` on a `page-board` page.
|
|
3
|
+
*
|
|
4
|
+
* Left to itself Adminium draws a board over the workflow enum it finds on the
|
|
5
|
+
* table, so a board's columns were a fixed list written into the app: a sales
|
|
6
|
+
* team could not add a stage of its own. An app says what the columns are
|
|
7
|
+
* instead:
|
|
8
|
+
*
|
|
9
|
+
* ```json
|
|
10
|
+
* "config": { "board": {
|
|
11
|
+
* "column": "stage_id",
|
|
12
|
+
* "columnsFrom": { "table": "crm_stages", "label": "name", "order": "position", "badge": { "column": "odds", "as": "percent" } },
|
|
13
|
+
* "title": "name",
|
|
14
|
+
* "totals": [{ "column": "amount", "fn": "sum" }, { "column": "weighted_value", "fn": "sum" }],
|
|
15
|
+
* "only": { "state": "open" },
|
|
16
|
+
* "card": { "link": "company_id.name", "person": "owner_id", "amount": "amount", "daysSince": { "column": "entered_stage_at", "warnFrom": 14, "alertFrom": 30 }, "date": "expected_close" },
|
|
17
|
+
* "note": { "text": "Columns come from Stages", "href": "/p/crm-stages" }
|
|
18
|
+
* } }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* - `column` (required): the column of the page's table a card is placed by.
|
|
22
|
+
* With `columnsFrom` it is a link to that table; without, an enum column,
|
|
23
|
+
* and the board's columns are the enum's values;
|
|
24
|
+
* - `columnsFrom`: the table whose rows are the board's columns — every row,
|
|
25
|
+
* a row with no card too — headed by its `label` column and ordered by its
|
|
26
|
+
* `order` column (left out: by its key). `badge` names one more column of
|
|
27
|
+
* those rows, shown small beside the heading: `as: "percent"` writes a
|
|
28
|
+
* share kept as a fraction (0.1) as "10%", `"number"` a plain number, and
|
|
29
|
+
* left out it is written as it is kept;
|
|
30
|
+
* - `title`: the column of the page's table a card is titled with;
|
|
31
|
+
* - `totals` (at most two): a number or money column of the page's table,
|
|
32
|
+
* summed or averaged over each column's cards and shown in its header;
|
|
33
|
+
* - `only` (one to three columns): which cards are on the board — a card is
|
|
34
|
+
* one when each column named holds its value, or one of its values. Both
|
|
35
|
+
* the cards listed and each header's count and totals are of those cards.
|
|
36
|
+
*
|
|
37
|
+
* - `card`: what a card shows under its title, each from a column of the
|
|
38
|
+
* page's table: `link` (`<link column>.<column of the row it points at>`:
|
|
39
|
+
* the company's name), `person` (a staff column, shown as the person's
|
|
40
|
+
* name), `amount` (a number or money), `daysSince` (days from a date or
|
|
41
|
+
* time column to today, by the server's clock; from `warnFrom` days the
|
|
42
|
+
* figure is amber and from `alertFrom` red; the longest-waiting cards come
|
|
43
|
+
* first) and `date` (a date or time, as a day);
|
|
44
|
+
* - `note`: one sentence drawn above the board, in the page's language
|
|
45
|
+
* (`text`, and `texts` by language as a page's `titles` are), with an
|
|
46
|
+
* optional `href` the whole note opens.
|
|
47
|
+
*
|
|
48
|
+
* Every figure and every name on the board is the READER's: a count and a
|
|
49
|
+
* total are of the cards their roles reach, a looked-up name is empty when
|
|
50
|
+
* its row is out of their reach, and a person is named as the people list
|
|
51
|
+
* names them.
|
|
52
|
+
*
|
|
53
|
+
* Every name is the app's own (a column ref), checked here against
|
|
54
|
+
* `requiredSchema`, so an app's CI refuses a typo long before an install.
|
|
55
|
+
*/
|
|
56
|
+
import { z } from 'zod';
|
|
57
|
+
import { type ColumnShape, type ReferenceIssue, type TableIndex } from './refs.js';
|
|
58
|
+
/** How a header's figure is worked out of its cards. */
|
|
59
|
+
export declare const PAGE_BOARD_TOTAL_FNS: readonly ["sum", "avg"];
|
|
60
|
+
/** The most figures a column's header shows beside its count. */
|
|
61
|
+
export declare const PAGE_BOARD_TOTALS_MAX = 2;
|
|
62
|
+
/** The most columns `only` tests, and the most values one of them lists. */
|
|
63
|
+
export declare const PAGE_BOARD_ONLY_MAX = 3;
|
|
64
|
+
export declare const PAGE_BOARD_ONLY_VALUES_MAX = 20;
|
|
65
|
+
/** Column types `only` compares: a choice, a yes/no, a link, text, a whole number. */
|
|
66
|
+
export declare const PAGE_BOARD_ONLY_TYPES: readonly string[];
|
|
67
|
+
/** Column types a card's `daysSince` and `date` read. */
|
|
68
|
+
export declare const PAGE_BOARD_DAY_TYPES: readonly string[];
|
|
69
|
+
declare const onlyValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
70
|
+
export declare const pageBoardOnlySchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>;
|
|
71
|
+
/** One `only` entry's values as a list, whichever way it was written. */
|
|
72
|
+
export declare function pageBoardOnlyValues(value: z.infer<typeof onlyValueSchema> | z.infer<typeof onlyValueSchema>[]): (string | number | boolean)[];
|
|
73
|
+
/** How a column's badge is written. */
|
|
74
|
+
export declare const PAGE_BOARD_BADGE_AS: readonly ["text", "number", "percent"];
|
|
75
|
+
/** The most days a card's `warnFrom` / `alertFrom` names. */
|
|
76
|
+
export declare const PAGE_BOARD_DAYS_MAX = 3650;
|
|
77
|
+
export declare const pageBoardCardSchema: z.ZodObject<{
|
|
78
|
+
link: z.ZodOptional<z.ZodString>;
|
|
79
|
+
person: z.ZodOptional<z.ZodString>;
|
|
80
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
81
|
+
daysSince: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
column: z.ZodString;
|
|
83
|
+
warnFrom: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
alertFrom: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
}, z.core.$strict>>;
|
|
86
|
+
date: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
export declare const pageBoardNoteSchema: z.ZodObject<{
|
|
89
|
+
text: z.ZodString;
|
|
90
|
+
texts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
91
|
+
href: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
export declare const pageBoardSchema: z.ZodObject<{
|
|
94
|
+
column: z.ZodString;
|
|
95
|
+
columnsFrom: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
table: z.ZodString;
|
|
97
|
+
label: z.ZodString;
|
|
98
|
+
order: z.ZodOptional<z.ZodString>;
|
|
99
|
+
badge: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
column: z.ZodString;
|
|
101
|
+
as: z.ZodOptional<z.ZodEnum<{
|
|
102
|
+
number: "number";
|
|
103
|
+
text: "text";
|
|
104
|
+
percent: "percent";
|
|
105
|
+
}>>;
|
|
106
|
+
}, z.core.$strict>>;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
card: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
link: z.ZodOptional<z.ZodString>;
|
|
110
|
+
person: z.ZodOptional<z.ZodString>;
|
|
111
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
112
|
+
daysSince: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
column: z.ZodString;
|
|
114
|
+
warnFrom: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
alertFrom: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
}, z.core.$strict>>;
|
|
117
|
+
date: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strict>>;
|
|
119
|
+
note: z.ZodOptional<z.ZodObject<{
|
|
120
|
+
text: z.ZodString;
|
|
121
|
+
texts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
122
|
+
href: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.core.$strict>>;
|
|
124
|
+
title: z.ZodOptional<z.ZodString>;
|
|
125
|
+
totals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
126
|
+
column: z.ZodString;
|
|
127
|
+
fn: z.ZodEnum<{
|
|
128
|
+
sum: "sum";
|
|
129
|
+
avg: "avg";
|
|
130
|
+
}>;
|
|
131
|
+
}, z.core.$strict>>>;
|
|
132
|
+
only: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
133
|
+
}, z.core.$strict>;
|
|
134
|
+
export type PageBoard = z.infer<typeof pageBoardSchema>;
|
|
135
|
+
/** What the check reads of a page. */
|
|
136
|
+
interface PageShape {
|
|
137
|
+
template: string;
|
|
138
|
+
bindings?: Readonly<Record<string, string>> | undefined;
|
|
139
|
+
config?: Readonly<Record<string, unknown>> | undefined;
|
|
140
|
+
}
|
|
141
|
+
/** Every problem with the pages' `config.board`, against the app's own tables. */
|
|
142
|
+
export declare function pageBoardIssues<C extends ColumnShape>(pages: readonly PageShape[], index: TableIndex<C>): ReferenceIssue[];
|
|
143
|
+
export {};
|
|
144
|
+
//# sourceMappingURL=page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;;;;;;;;;;;;;;kBAiBjB,CAAC;AACZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,sCAAsC;AACtC,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IACxD,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;CACxD;AAQD,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,cAAc,EAAE,CAgI1H"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* A board page's columns: `config.board` on a `page-board` page.
|
|
4
|
+
*
|
|
5
|
+
* Left to itself Adminium draws a board over the workflow enum it finds on the
|
|
6
|
+
* table, so a board's columns were a fixed list written into the app: a sales
|
|
7
|
+
* team could not add a stage of its own. An app says what the columns are
|
|
8
|
+
* instead:
|
|
9
|
+
*
|
|
10
|
+
* ```json
|
|
11
|
+
* "config": { "board": {
|
|
12
|
+
* "column": "stage_id",
|
|
13
|
+
* "columnsFrom": { "table": "crm_stages", "label": "name", "order": "position", "badge": { "column": "odds", "as": "percent" } },
|
|
14
|
+
* "title": "name",
|
|
15
|
+
* "totals": [{ "column": "amount", "fn": "sum" }, { "column": "weighted_value", "fn": "sum" }],
|
|
16
|
+
* "only": { "state": "open" },
|
|
17
|
+
* "card": { "link": "company_id.name", "person": "owner_id", "amount": "amount", "daysSince": { "column": "entered_stage_at", "warnFrom": 14, "alertFrom": 30 }, "date": "expected_close" },
|
|
18
|
+
* "note": { "text": "Columns come from Stages", "href": "/p/crm-stages" }
|
|
19
|
+
* } }
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* - `column` (required): the column of the page's table a card is placed by.
|
|
23
|
+
* With `columnsFrom` it is a link to that table; without, an enum column,
|
|
24
|
+
* and the board's columns are the enum's values;
|
|
25
|
+
* - `columnsFrom`: the table whose rows are the board's columns — every row,
|
|
26
|
+
* a row with no card too — headed by its `label` column and ordered by its
|
|
27
|
+
* `order` column (left out: by its key). `badge` names one more column of
|
|
28
|
+
* those rows, shown small beside the heading: `as: "percent"` writes a
|
|
29
|
+
* share kept as a fraction (0.1) as "10%", `"number"` a plain number, and
|
|
30
|
+
* left out it is written as it is kept;
|
|
31
|
+
* - `title`: the column of the page's table a card is titled with;
|
|
32
|
+
* - `totals` (at most two): a number or money column of the page's table,
|
|
33
|
+
* summed or averaged over each column's cards and shown in its header;
|
|
34
|
+
* - `only` (one to three columns): which cards are on the board — a card is
|
|
35
|
+
* one when each column named holds its value, or one of its values. Both
|
|
36
|
+
* the cards listed and each header's count and totals are of those cards.
|
|
37
|
+
*
|
|
38
|
+
* - `card`: what a card shows under its title, each from a column of the
|
|
39
|
+
* page's table: `link` (`<link column>.<column of the row it points at>`:
|
|
40
|
+
* the company's name), `person` (a staff column, shown as the person's
|
|
41
|
+
* name), `amount` (a number or money), `daysSince` (days from a date or
|
|
42
|
+
* time column to today, by the server's clock; from `warnFrom` days the
|
|
43
|
+
* figure is amber and from `alertFrom` red; the longest-waiting cards come
|
|
44
|
+
* first) and `date` (a date or time, as a day);
|
|
45
|
+
* - `note`: one sentence drawn above the board, in the page's language
|
|
46
|
+
* (`text`, and `texts` by language as a page's `titles` are), with an
|
|
47
|
+
* optional `href` the whole note opens.
|
|
48
|
+
*
|
|
49
|
+
* Every figure and every name on the board is the READER's: a count and a
|
|
50
|
+
* total are of the cards their roles reach, a looked-up name is empty when
|
|
51
|
+
* its row is out of their reach, and a person is named as the people list
|
|
52
|
+
* names them.
|
|
53
|
+
*
|
|
54
|
+
* Every name is the app's own (a column ref), checked here against
|
|
55
|
+
* `requiredSchema`, so an app's CI refuses a typo long before an install.
|
|
56
|
+
*/
|
|
57
|
+
import { z } from 'zod';
|
|
58
|
+
import { NUMERIC_TYPES, refSchema, valueFits } from './refs.js';
|
|
59
|
+
/** How a header's figure is worked out of its cards. */
|
|
60
|
+
export const PAGE_BOARD_TOTAL_FNS = ['sum', 'avg'];
|
|
61
|
+
/** The most figures a column's header shows beside its count. */
|
|
62
|
+
export const PAGE_BOARD_TOTALS_MAX = 2;
|
|
63
|
+
/** The most columns `only` tests, and the most values one of them lists. */
|
|
64
|
+
export const PAGE_BOARD_ONLY_MAX = 3;
|
|
65
|
+
export const PAGE_BOARD_ONLY_VALUES_MAX = 20;
|
|
66
|
+
/** Column types `only` compares: a choice, a yes/no, a link, text, a whole number. */
|
|
67
|
+
export const PAGE_BOARD_ONLY_TYPES = ['enum', 'bool', 'fk', 'text', 'int', 'bigint'];
|
|
68
|
+
/** Column types a card's `daysSince` and `date` read. */
|
|
69
|
+
export const PAGE_BOARD_DAY_TYPES = ['date', 'timestamp', 'timestamptz', 'datetime'];
|
|
70
|
+
const onlyValueSchema = z.union([z.string().min(1).max(200), z.number().finite(), z.boolean()]);
|
|
71
|
+
export const pageBoardOnlySchema = z
|
|
72
|
+
.record(refSchema, z.union([onlyValueSchema, z.array(onlyValueSchema).min(1).max(PAGE_BOARD_ONLY_VALUES_MAX)]))
|
|
73
|
+
.refine((only) => Object.keys(only).length >= 1 && Object.keys(only).length <= PAGE_BOARD_ONLY_MAX, {
|
|
74
|
+
message: `only names one to ${String(PAGE_BOARD_ONLY_MAX)} columns`,
|
|
75
|
+
});
|
|
76
|
+
/** One `only` entry's values as a list, whichever way it was written. */
|
|
77
|
+
export function pageBoardOnlyValues(value) {
|
|
78
|
+
return Array.isArray(value) ? value : [value];
|
|
79
|
+
}
|
|
80
|
+
/** How a column's badge is written. */
|
|
81
|
+
export const PAGE_BOARD_BADGE_AS = ['text', 'number', 'percent'];
|
|
82
|
+
/** The most days a card's `warnFrom` / `alertFrom` names. */
|
|
83
|
+
export const PAGE_BOARD_DAYS_MAX = 3650;
|
|
84
|
+
const localeTag = z.string().regex(/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/);
|
|
85
|
+
export const pageBoardCardSchema = z
|
|
86
|
+
.object({
|
|
87
|
+
link: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*\.[A-Za-z_][A-Za-z0-9_]*$/).optional(),
|
|
88
|
+
person: refSchema.optional(),
|
|
89
|
+
amount: refSchema.optional(),
|
|
90
|
+
daysSince: z
|
|
91
|
+
.object({ column: refSchema, warnFrom: z.number().int().min(1).max(PAGE_BOARD_DAYS_MAX).optional(), alertFrom: z.number().int().min(1).max(PAGE_BOARD_DAYS_MAX).optional() })
|
|
92
|
+
.strict()
|
|
93
|
+
.refine((days) => days.warnFrom === undefined || days.alertFrom === undefined || days.warnFrom < days.alertFrom, { message: 'warnFrom comes before alertFrom' })
|
|
94
|
+
.optional(),
|
|
95
|
+
date: refSchema.optional(),
|
|
96
|
+
})
|
|
97
|
+
.strict()
|
|
98
|
+
.refine((card) => Object.keys(card).length > 0, { message: 'a card names at least one thing to show' });
|
|
99
|
+
export const pageBoardNoteSchema = z
|
|
100
|
+
.object({
|
|
101
|
+
text: z.string().min(1).max(200),
|
|
102
|
+
texts: z.record(localeTag, z.string().min(1).max(200)).optional(),
|
|
103
|
+
// A path of this workspace: never an address elsewhere, and never a script.
|
|
104
|
+
href: z.string().regex(/^\/(?!\/)[^\s\\]{0,299}$/).optional(),
|
|
105
|
+
})
|
|
106
|
+
.strict();
|
|
107
|
+
export const pageBoardSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
column: refSchema,
|
|
110
|
+
columnsFrom: z
|
|
111
|
+
.object({ table: refSchema, label: refSchema, order: refSchema.optional(), badge: z.object({ column: refSchema, as: z.enum(PAGE_BOARD_BADGE_AS).optional() }).strict().optional() })
|
|
112
|
+
.strict()
|
|
113
|
+
.optional(),
|
|
114
|
+
card: pageBoardCardSchema.optional(),
|
|
115
|
+
note: pageBoardNoteSchema.optional(),
|
|
116
|
+
title: refSchema.optional(),
|
|
117
|
+
totals: z
|
|
118
|
+
.array(z.object({ column: refSchema, fn: z.enum(PAGE_BOARD_TOTAL_FNS) }).strict())
|
|
119
|
+
.min(1)
|
|
120
|
+
.max(PAGE_BOARD_TOTALS_MAX)
|
|
121
|
+
.optional(),
|
|
122
|
+
only: pageBoardOnlySchema.optional(),
|
|
123
|
+
})
|
|
124
|
+
.strict();
|
|
125
|
+
/** The table a page reads: its one binding, or the one keyed `rows`. */
|
|
126
|
+
function pageTable(page) {
|
|
127
|
+
const entries = Object.values(page.bindings ?? {});
|
|
128
|
+
return entries.length === 1 ? entries[0] : page.bindings?.['rows'];
|
|
129
|
+
}
|
|
130
|
+
/** Every problem with the pages' `config.board`, against the app's own tables. */
|
|
131
|
+
export function pageBoardIssues(pages, index) {
|
|
132
|
+
const out = [];
|
|
133
|
+
pages.forEach((page, p) => {
|
|
134
|
+
const raw = page.config?.['board'];
|
|
135
|
+
if (raw === undefined)
|
|
136
|
+
return;
|
|
137
|
+
const at = (...rest) => ['pages', p, 'config', 'board', ...rest];
|
|
138
|
+
const parsed = pageBoardSchema.safeParse(raw);
|
|
139
|
+
if (!parsed.success) {
|
|
140
|
+
for (const issue of parsed.error.issues)
|
|
141
|
+
out.push({ path: at(...issue.path.map((key) => (typeof key === 'symbol' ? String(key) : key))), message: issue.message });
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (page.template !== 'page-board') {
|
|
145
|
+
out.push({ path: at(), message: `only a page-board takes its columns from config.board, not a ${page.template}` });
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const table = pageTable(page);
|
|
149
|
+
if (table === undefined || index.table(table) === undefined) {
|
|
150
|
+
out.push({ path: at(), message: 'a board names its columns on a page bound to a table of the app' });
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const board = parsed.data;
|
|
154
|
+
const column = index.column(table, board.column);
|
|
155
|
+
const from = board.columnsFrom;
|
|
156
|
+
if (column === undefined)
|
|
157
|
+
out.push({ path: at('column'), message: `"${table}" has no column "${board.column}"` });
|
|
158
|
+
else if (from === undefined) {
|
|
159
|
+
if (column.type !== 'enum')
|
|
160
|
+
out.push({ path: at('column'), message: `"${table}.${board.column}" is not an enum: name the table its columns come from in columnsFrom, or place cards by an enum column` });
|
|
161
|
+
}
|
|
162
|
+
else if (column.type !== 'fk' || column.references !== from.table) {
|
|
163
|
+
out.push({ path: at('column'), message: `"${table}.${board.column}" is not a link to "${from.table}"` });
|
|
164
|
+
}
|
|
165
|
+
if (from !== undefined) {
|
|
166
|
+
if (index.table(from.table) === undefined)
|
|
167
|
+
out.push({ path: at('columnsFrom', 'table'), message: `the app has no table "${from.table}"` });
|
|
168
|
+
else {
|
|
169
|
+
for (const key of ['label', 'order']) {
|
|
170
|
+
const name = from[key];
|
|
171
|
+
if (name !== undefined && !index.has(from.table, name))
|
|
172
|
+
out.push({ path: at('columnsFrom', key), message: `"${from.table}" has no column "${name}"` });
|
|
173
|
+
}
|
|
174
|
+
const badge = from.badge === undefined ? undefined : index.column(from.table, from.badge.column);
|
|
175
|
+
if (from.badge !== undefined && badge === undefined)
|
|
176
|
+
out.push({ path: at('columnsFrom', 'badge', 'column'), message: `"${from.table}" has no column "${from.badge.column}"` });
|
|
177
|
+
else if (badge !== undefined && from.badge?.as !== undefined && from.badge.as !== 'text' && !NUMERIC_TYPES.includes(badge.type)) {
|
|
178
|
+
out.push({ path: at('columnsFrom', 'badge', 'as'), message: `"${from.table}.${badge.ref}" is not a number, so it cannot be written as a ${from.badge.as}` });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (board.title !== undefined && !index.has(table, board.title)) {
|
|
183
|
+
out.push({ path: at('title'), message: `"${table}" has no column "${board.title}"` });
|
|
184
|
+
}
|
|
185
|
+
(board.totals ?? []).forEach((total, t) => {
|
|
186
|
+
const summed = index.column(table, total.column);
|
|
187
|
+
if (summed === undefined)
|
|
188
|
+
out.push({ path: at('totals', t, 'column'), message: `"${table}" has no column "${total.column}"` });
|
|
189
|
+
else if (!NUMERIC_TYPES.includes(summed.type))
|
|
190
|
+
out.push({ path: at('totals', t, 'column'), message: `"${table}.${total.column}" is not a number or money, so it cannot be totalled` });
|
|
191
|
+
if ((board.totals ?? []).findIndex((other) => other.column === total.column && other.fn === total.fn) !== t) {
|
|
192
|
+
out.push({ path: at('totals', t), message: `"${total.column}" is totalled this way twice` });
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
const card = board.card ?? {};
|
|
196
|
+
if (card.link !== undefined) {
|
|
197
|
+
const [via, shown] = card.link.split('.');
|
|
198
|
+
const link = index.column(table, via);
|
|
199
|
+
if (link === undefined)
|
|
200
|
+
out.push({ path: at('card', 'link'), message: `"${table}" has no column "${via}"` });
|
|
201
|
+
else if (link.type !== 'fk' || link.references === undefined)
|
|
202
|
+
out.push({ path: at('card', 'link'), message: `"${table}.${via}" is not a link, so a card has no row to read "${shown}" from` });
|
|
203
|
+
// A link to a table the manifest cannot see (an add-on's) is judged at the install, by the real table.
|
|
204
|
+
else if (index.table(link.references) !== undefined && !index.has(link.references, shown))
|
|
205
|
+
out.push({ path: at('card', 'link'), message: `"${link.references}" has no column "${shown}"` });
|
|
206
|
+
}
|
|
207
|
+
if (card.person !== undefined) {
|
|
208
|
+
const person = index.column(table, card.person);
|
|
209
|
+
if (person === undefined)
|
|
210
|
+
out.push({ path: at('card', 'person'), message: `"${table}" has no column "${card.person}"` });
|
|
211
|
+
else if (person.rules?.staff !== true)
|
|
212
|
+
out.push({ path: at('card', 'person'), message: `"${table}.${card.person}" is not a staff column (rules.staff), so it holds no person to name` });
|
|
213
|
+
}
|
|
214
|
+
if (card.amount !== undefined) {
|
|
215
|
+
const amount = index.column(table, card.amount);
|
|
216
|
+
if (amount === undefined)
|
|
217
|
+
out.push({ path: at('card', 'amount'), message: `"${table}" has no column "${card.amount}"` });
|
|
218
|
+
else if (!NUMERIC_TYPES.includes(amount.type))
|
|
219
|
+
out.push({ path: at('card', 'amount'), message: `"${table}.${card.amount}" is not a number or money` });
|
|
220
|
+
}
|
|
221
|
+
for (const [key, name] of [['daysSince', card.daysSince?.column], ['date', card.date]]) {
|
|
222
|
+
if (name === undefined)
|
|
223
|
+
continue;
|
|
224
|
+
const day = index.column(table, name);
|
|
225
|
+
const here = key === 'daysSince' ? at('card', 'daysSince', 'column') : at('card', 'date');
|
|
226
|
+
if (day === undefined)
|
|
227
|
+
out.push({ path: here, message: `"${table}" has no column "${name}"` });
|
|
228
|
+
else if (!PAGE_BOARD_DAY_TYPES.includes(day.type))
|
|
229
|
+
out.push({ path: here, message: `"${table}.${name}" is a ${day.type}, not a date or a time` });
|
|
230
|
+
}
|
|
231
|
+
for (const [name, written] of Object.entries(board.only ?? {})) {
|
|
232
|
+
const tested = index.column(table, name);
|
|
233
|
+
if (tested === undefined) {
|
|
234
|
+
out.push({ path: at('only', name), message: `"${table}" has no column "${name}"` });
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
if (name === board.column) {
|
|
238
|
+
out.push({ path: at('only', name), message: `"${name}" is what the board's columns are: leave a column out of the board by its own table or enum, not by only` });
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (!PAGE_BOARD_ONLY_TYPES.includes(tested.type)) {
|
|
242
|
+
out.push({ path: at('only', name), message: `"${table}.${name}" is a ${tested.type}: only compares a choice, a yes/no, a link, text or a whole number` });
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
const values = pageBoardOnlyValues(written);
|
|
246
|
+
/*
|
|
247
|
+
* A link holds the key of the row it points at: a whole number or text,
|
|
248
|
+
* whichever that table is keyed by. Where the table is one of the app's
|
|
249
|
+
* own its key is known, and a value of the other kind is refused here:
|
|
250
|
+
* installed, the server could not compare it with the column, and every
|
|
251
|
+
* read of the board's columns would fail. A link to a table the manifest
|
|
252
|
+
* cannot see takes either, and the install judges it by the real column.
|
|
253
|
+
*/
|
|
254
|
+
const linked = tested.type !== 'fk' || tested.references === undefined ? undefined : index.table(tested.references);
|
|
255
|
+
const key = linked === undefined ? undefined : (index.pk(linked.ref) ?? index.column(linked.ref, 'id'));
|
|
256
|
+
const fits = (value) => tested.type !== 'fk'
|
|
257
|
+
? valueFits(tested, value)
|
|
258
|
+
: key === undefined
|
|
259
|
+
? typeof value === 'string' || (typeof value === 'number' && Number.isInteger(value))
|
|
260
|
+
: valueFits({ ref: key.ref, type: key.type }, value);
|
|
261
|
+
const whole = key !== undefined && (key.type === 'int' || key.type === 'bigint');
|
|
262
|
+
for (const value of values) {
|
|
263
|
+
if (fits(value))
|
|
264
|
+
continue;
|
|
265
|
+
out.push({
|
|
266
|
+
path: at('only', name),
|
|
267
|
+
message: tested.type === 'enum' && typeof value === 'string'
|
|
268
|
+
? `"${value}" is not one of the values of "${table}.${name}" (${(tested.enum ?? []).join(', ')})`
|
|
269
|
+
: key !== undefined && linked !== undefined
|
|
270
|
+
? `${JSON.stringify(value)} is not a value "${table}.${name}" can hold: it links to "${linked.ref}", whose key is ${whole ? 'a whole number' : 'text'}`
|
|
271
|
+
: `${JSON.stringify(value)} is not a value "${table}.${name}" (${tested.type}) can hold`,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
if (new Set(values).size !== values.length)
|
|
275
|
+
out.push({ path: at('only', name), message: `"${name}" lists a value twice` });
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
return out;
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=page-board.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-board.js","sourceRoot":"","sources":["../src/page-board.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,OAAO,EAAE,CAAC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H,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/public-access.d.ts
CHANGED
|
@@ -436,6 +436,7 @@ export declare const publicAccessSchema: z.ZodObject<{
|
|
|
436
436
|
}, z.core.$strict>>;
|
|
437
437
|
writableValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>;
|
|
438
438
|
requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
439
|
+
requiresWhen: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>>>;
|
|
439
440
|
writableWhen: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>>, z.ZodLiteral<"from-now">, z.ZodLiteral<"from-today">, z.ZodLiteral<"before-today">, z.ZodObject<{
|
|
440
441
|
within: z.ZodNumber;
|
|
441
442
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -684,6 +685,7 @@ export declare const publicAccessSchema: z.ZodObject<{
|
|
|
684
685
|
when: z.ZodOptional<z.ZodLiteral<"anonymous">>;
|
|
685
686
|
}, z.core.$strict>>>;
|
|
686
687
|
key: z.ZodOptional<z.ZodString>;
|
|
688
|
+
module: z.ZodOptional<z.ZodString>;
|
|
687
689
|
confirm: z.ZodOptional<z.ZodObject<{
|
|
688
690
|
template: z.ZodEnum<{
|
|
689
691
|
"booking-confirmation": "booking-confirmation";
|
|
@@ -841,6 +843,10 @@ interface PublicAccessContext {
|
|
|
841
843
|
screensOnly?: boolean | undefined;
|
|
842
844
|
cloneFrom?: string | undefined;
|
|
843
845
|
permissions?: readonly string[] | undefined;
|
|
846
|
+
/** What the role is limited to, by table: read here only for whether its rows are (`rows`). */
|
|
847
|
+
limits?: Readonly<Record<string, {
|
|
848
|
+
rows?: unknown;
|
|
849
|
+
} | undefined>> | undefined;
|
|
844
850
|
}[];
|
|
845
851
|
/** The app's outbox, for a new link it emails (absent: the app has none). */
|
|
846
852
|
outbox?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-access.d.ts","sourceRoot":"","sources":["../src/public-access.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EAML,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAInB,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,wDAAwD;AACxD,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC,mFAAmF;AACnF,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,iHAAiH;AACjH,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;GAGG;AACH,QAAA,MAAM,qBAAqB;;;;oBASzB,CAAC;AAGH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEvE,2CAA2C;AAC3C,eAAO,MAAM,YAAY,GAAI,OAAO,kBAAkB,KAAG,MAA4D,CAAC;AAEtH,4CAA4C;AAC5C,eAAO,MAAM,YAAY,GAAI,OAAO,kBAAkB,KAAG,MAAsF,CAAC;AAsEhJ,eAAO,MAAM,WAAW;;;;;;;;;;;;;;oBAAkE,CAAC;AAC3F,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,KAAK,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,SAAS,YAAY,EAAE,EAAE,GAAG,EAAE,mBAAmB,GAAG,cAAc,EAAE,CAglB/G;AAuiCD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,SAAS,YAAY,EAAE,EACrC,MAAM,EAAE,SAAS;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,EAAE,CAAA;CAAE,EAAE,GACpH;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CA8BrC"}
|
package/dist/public-access.js
CHANGED
|
@@ -476,6 +476,17 @@ export const publicAccessSchema = z
|
|
|
476
476
|
* refused rather than stored half.
|
|
477
477
|
*/
|
|
478
478
|
requires: z.array(refSchema).min(1).max(8).optional(),
|
|
479
|
+
/**
|
|
480
|
+
* Columns a write must fill only when it sets another column to one of
|
|
481
|
+
* some values, and may write at no other time: `{accepted_name: {status:
|
|
482
|
+
* [accepted]}}` — accepting carries the name typed, declining carries
|
|
483
|
+
* none, and a name sent with a decline is refused, so a declined quote
|
|
484
|
+
* never holds one a stranger typed.
|
|
485
|
+
*/
|
|
486
|
+
requiresWhen: z
|
|
487
|
+
.record(refSchema, z.record(refSchema, valuesSchema).refine((when) => Object.keys(when).length === 1, { message: 'a column is asked for by one other column\'s values' }))
|
|
488
|
+
.refine((asked) => Object.keys(asked).length >= 1 && Object.keys(asked).length <= 8, { message: 'requiresWhen names 1 to 8 columns' })
|
|
489
|
+
.optional(),
|
|
479
490
|
/**
|
|
480
491
|
* The state a row must be IN to be changed — part of the update itself,
|
|
481
492
|
* never of a read, so a finished visit still lists but cannot be moved.
|
|
@@ -551,6 +562,8 @@ export const publicAccessSchema = z
|
|
|
551
562
|
.optional(),
|
|
552
563
|
/** Which browser key serves the entry: `customer`, or one of `publicKeys`. */
|
|
553
564
|
key: keyNameSchema.optional(),
|
|
565
|
+
/** The part of the app the entry belongs to: closed while it is off (see `modules.ts`). */
|
|
566
|
+
module: z.string().regex(/^[a-z][a-z0-9-]{0,39}$/, 'a module id is kebab-case').optional(),
|
|
554
567
|
/**
|
|
555
568
|
* The confirmation Adminium emails when a guest creates a row here: the
|
|
556
569
|
* column holding their address, the columns the email shows, the app's
|
|
@@ -764,6 +777,27 @@ export function publicAccessIssues(entries, ctx) {
|
|
|
764
777
|
message: `"${role.key}" signs in a screen anyone can walk up to, so it opens only the app's screens: screensOnly, and no grant but app:@:staff`,
|
|
765
778
|
});
|
|
766
779
|
}
|
|
780
|
+
/*
|
|
781
|
+
* A SCREEN'S KEY IS NOT HELD TO A PERSON'S ROWS: its entries show what
|
|
782
|
+
* they declare to everybody who signs the screen in. The screen's own role
|
|
783
|
+
* holds no table at all, so the person in front of it is somebody who
|
|
784
|
+
* also holds another role of the app — and where that role reaches only
|
|
785
|
+
* some rows of a table, the screen would show them the rest. So a table
|
|
786
|
+
* any role of the app limits by rows is not served through a screen's
|
|
787
|
+
* key: it is either shown on the screen to everybody, or limited by rows
|
|
788
|
+
* and kept off it.
|
|
789
|
+
*/
|
|
790
|
+
entries.forEach((entry, i) => {
|
|
791
|
+
if (entry.key !== name)
|
|
792
|
+
return;
|
|
793
|
+
const limiting = ctx.roles.find((candidate) => candidate.limits?.[entry.table]?.rows !== undefined);
|
|
794
|
+
if (limiting !== undefined) {
|
|
795
|
+
out.push({
|
|
796
|
+
path: ['publicAccess', i, 'table'],
|
|
797
|
+
message: `"${name}" shows "${entry.table}" to everybody who signs the screen in, and "${limiting.key}" reaches only some of its rows: a screen's key is not held to a person's rows, so give the table one or the other`,
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
});
|
|
767
801
|
if (key.enabledBy !== undefined) {
|
|
768
802
|
const column = index.column(key.enabledBy.table, key.enabledBy.column);
|
|
769
803
|
if (column?.type !== 'bool') {
|
|
@@ -877,6 +911,14 @@ export function publicAccessIssues(entries, ctx) {
|
|
|
877
911
|
if (decided.has(ref))
|
|
878
912
|
out.push({ path: at('writable'), message: `"${ref}" is decided by Adminium and cannot be written publicly` });
|
|
879
913
|
}
|
|
914
|
+
// A file column names a file a signed-in staff member uploaded: a browser's key uploads nothing, so it names none.
|
|
915
|
+
for (const [list, refs] of [['writable', [...writable]], ['defaults', Object.keys(entry.defaults ?? {})]]) {
|
|
916
|
+
for (const ref of refs) {
|
|
917
|
+
const found = ctx.index.column(entry.table, ref);
|
|
918
|
+
if (found?.rules?.file !== undefined)
|
|
919
|
+
out.push({ path: at(list), message: `"${entry.table}.${ref}" holds files a signed-in person uploads, so a public write never sets it` });
|
|
920
|
+
}
|
|
921
|
+
}
|
|
880
922
|
// A filter narrows every read AND write, so a column it names cannot also
|
|
881
923
|
// change: the row would leave the endpoint mid-write — unless both ends
|
|
882
924
|
// of the change are pinned, the state it starts from (`writableWhen`) and
|
|
@@ -1099,7 +1141,37 @@ export function publicAccessIssues(entries, ctx) {
|
|
|
1099
1141
|
if (!writable.has(ref))
|
|
1100
1142
|
out.push({ path: at('requires'), message: `"${ref}" is not writable, so a write cannot fill it` });
|
|
1101
1143
|
}
|
|
1144
|
+
// A column asked for only with some values of another: both written here, and the values among those the other may take.
|
|
1145
|
+
for (const [ref, when] of Object.entries(entry.requiresWhen ?? {})) {
|
|
1146
|
+
const here = at('requiresWhen', ref);
|
|
1147
|
+
if (!writable.has(ref))
|
|
1148
|
+
out.push({ path: here, message: `"${ref}" is not writable, so a write cannot fill it` });
|
|
1149
|
+
if ((entry.requires ?? []).includes(ref))
|
|
1150
|
+
out.push({ path: here, message: `"${ref}" is required by every write already (requires): say one or the other` });
|
|
1151
|
+
for (const [other, values] of Object.entries(when)) {
|
|
1152
|
+
if (other === ref)
|
|
1153
|
+
out.push({ path: here, message: `"${ref}" is asked for by another column's values, not its own` });
|
|
1154
|
+
else if (!writable.has(other))
|
|
1155
|
+
out.push({ path: here, message: `"${other}" is not writable, so a write never sets it` });
|
|
1156
|
+
const pinned = entry.writableValues?.[other];
|
|
1157
|
+
if (pinned === undefined) {
|
|
1158
|
+
if (writable.has(other))
|
|
1159
|
+
out.push({ path: here, message: `"${other}" decides when "${ref}" is asked for: list the values it may take (writableValues)` });
|
|
1160
|
+
continue;
|
|
1161
|
+
}
|
|
1162
|
+
for (const value of values) {
|
|
1163
|
+
if (!pinned.some((allowed) => allowed === value))
|
|
1164
|
+
out.push({ path: here, message: `${JSON.stringify(value)} is not a value a write here may give "${other}"` });
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1102
1168
|
const states = table.states;
|
|
1169
|
+
// The last day of a move of this table (`requires.notPast`) is the staff's to set: a guest who could write it would move their own deadline, then make the move.
|
|
1170
|
+
const lastDays = new Set(Object.values(states?.moves ?? {}).flatMap((moves) => moves.flatMap((move) => (typeof move === 'string' || move.requires?.notPast === undefined ? [] : [move.requires.notPast]))));
|
|
1171
|
+
for (const lastDay of lastDays) {
|
|
1172
|
+
if (writable.has(lastDay))
|
|
1173
|
+
out.push({ path: at('writable'), message: `"${lastDay}" is the last day of a move of "${entry.table}", so a write through this entry may not set it` });
|
|
1174
|
+
}
|
|
1103
1175
|
for (const [ref, values] of Object.entries(entry.writableValues ?? {})) {
|
|
1104
1176
|
if (!writable.has(ref))
|
|
1105
1177
|
out.push({ path: at('writableValues', ref), message: `"${ref}" is not writable` });
|
|
@@ -2184,6 +2256,8 @@ function personIssues(entries, ctx, identities) {
|
|
|
2184
2256
|
const declared = (box.producers ?? []).find((producer) => producer.kind === entry.newLink.kind);
|
|
2185
2257
|
if (declared?.hold === true)
|
|
2186
2258
|
out.push({ path: here('kind'), message: `"${entry.newLink.kind}" waits for a person to approve it, so it is never sent again from a link` });
|
|
2259
|
+
if (declared !== undefined && 'onDelete' in declared)
|
|
2260
|
+
out.push({ path: here('kind'), message: `"${entry.newLink.kind}" is written when a row is removed, so it is never sent from a link of a row that is there` });
|
|
2187
2261
|
if (declared?.repeatBy !== undefined && declared.repeatBy !== entry.newLink.column) {
|
|
2188
2262
|
out.push({ path: here('kind'), message: `"${entry.newLink.kind}" is sent once per "${declared.repeatBy}", so one sent again for a new "${entry.newLink.column}" would be skipped: its producer repeats by "${entry.newLink.column}" or by nothing` });
|
|
2189
2263
|
}
|