@delurio/cli 0.7.0 → 0.9.0
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 +55 -0
- package/README.md +38 -5
- package/SPEC.md +210 -22
- package/dist/changes.d.ts +4 -2
- package/dist/changes.js +32 -10
- package/dist/check.d.ts +1 -1
- package/dist/check.js +231 -34
- package/dist/diff-nav.js +15 -5
- package/dist/domain-names.d.ts +18 -0
- package/dist/domain-names.js +124 -0
- package/dist/domain.js +1 -1
- package/dist/graph.d.ts +40 -0
- package/dist/graph.js +190 -21
- package/dist/html.d.ts +1 -1
- package/dist/html.js +1 -1
- package/dist/invokes.d.ts +10 -0
- package/dist/invokes.js +67 -0
- package/dist/kit.d.ts +2 -1
- package/dist/kit.js +1 -1
- package/dist/model.d.ts +31 -1
- package/dist/model.js +193 -33
- package/dist/nav-page.js +15 -3
- package/dist/nav.d.ts +20 -1
- package/dist/nav.js +37 -25
- package/dist/needs.d.ts +50 -0
- package/dist/needs.js +311 -0
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +4 -2
- package/dist/starts.js +8 -1
- package/dist/tutorial-check.d.ts +9 -0
- package/dist/tutorial-check.js +297 -0
- package/dist/ui-check.d.ts +8 -0
- package/dist/ui-check.js +136 -0
- package/dist/wireframe.js +26 -5
- package/dist/yaml.d.ts +1 -0
- package/dist/yaml.js +36 -5
- package/package.json +2 -1
- package/schemas/domain.schema.json +7 -7
- package/schemas/gaps.schema.json +49 -0
- package/schemas/nav.schema.json +34 -3
- package/schemas/needs.schema.json +189 -0
- package/schemas/ui.schema.json +108 -11
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Graph } from './graph.ts';
|
|
2
|
+
export interface UiProblem {
|
|
3
|
+
rule: 'focus-not-shown' | 'returns-focus-not-dialog' | 'task-locale';
|
|
4
|
+
path: string[];
|
|
5
|
+
message: string;
|
|
6
|
+
element: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function checkUi(g: Graph, warn: (message: string) => void): UiProblem[];
|
package/dist/ui-check.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// What `check` holds in ui.yaml beyond its schema (SPEC.md §4): `focus` and `returnsFocus` give the focus to a node
|
|
2
|
+
// that is shown where the focus goes, `returnsFocus` starts at a dialog, the words a field's `value` takes from the
|
|
3
|
+
// catalog are there, as every other node's are, and the flow's name for its users (`task`) is in every locale. That `value`, `checked` and `script` sit only on the nodes they
|
|
4
|
+
// are for is the schema's; that a `focus` state exists and that `checked` reads the context is the loader's.
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import { basename, dirname, join } from 'node:path';
|
|
7
|
+
import { alternatives, isDialog, OPENER, shownIn } from './graph.js';
|
|
8
|
+
const listed = (xs) => (xs.length <= 1 ? xs.join('') : `${xs.slice(0, -1).join(', ')} and ${xs[xs.length - 1]}`);
|
|
9
|
+
// the states the flow stops in after a transition out of `state` (on `event` only, when it is given): its targets, and
|
|
10
|
+
// past a state with `always` the targets of that state, as far as they go
|
|
11
|
+
function stopsAfter(g, state, event) {
|
|
12
|
+
const out = [];
|
|
13
|
+
const seen = new Set();
|
|
14
|
+
const ways = (s) => {
|
|
15
|
+
const st = g.flow.states[s];
|
|
16
|
+
return [...(st.always ?? []).map((a) => a.target), ...Object.values(st.on ?? {}).flatMap((spec) => alternatives(spec).map((a) => a.target))];
|
|
17
|
+
};
|
|
18
|
+
const first = g.flow.states[state].on?.[event ?? ''];
|
|
19
|
+
const todo = event === undefined ? ways(state) : first === undefined ? [] : alternatives(first).map((a) => a.target);
|
|
20
|
+
while (todo.length > 0) {
|
|
21
|
+
const t = todo.shift();
|
|
22
|
+
if (seen.has(t))
|
|
23
|
+
continue;
|
|
24
|
+
seen.add(t);
|
|
25
|
+
if (g.flow.states[t].always !== undefined)
|
|
26
|
+
todo.push(...ways(t));
|
|
27
|
+
else
|
|
28
|
+
out.push(t);
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
// the states a dialog closes into: those the flow stops in after a state that shows it, and that do not show it
|
|
33
|
+
function closesInto(g, dialog) {
|
|
34
|
+
const d = g.ui.nodes[dialog];
|
|
35
|
+
const out = new Set();
|
|
36
|
+
for (const s of Object.keys(g.flow.states)) {
|
|
37
|
+
if (!shownIn(d, s))
|
|
38
|
+
continue;
|
|
39
|
+
for (const t of stopsAfter(g, s))
|
|
40
|
+
if (!shownIn(d, t))
|
|
41
|
+
out.add(t);
|
|
42
|
+
}
|
|
43
|
+
return [...out];
|
|
44
|
+
}
|
|
45
|
+
// the nodes that open a dialog: each is shown in a state that does not show the dialog, and sends an event that leads
|
|
46
|
+
// from there to a state that shows it (SPEC.md §4, the node that opened a dialog)
|
|
47
|
+
function openersOf(g, dialog) {
|
|
48
|
+
const d = g.ui.nodes[dialog];
|
|
49
|
+
const out = [];
|
|
50
|
+
for (const [id, n] of Object.entries(g.ui.nodes)) {
|
|
51
|
+
if (n.emits === undefined)
|
|
52
|
+
continue;
|
|
53
|
+
const opens = Object.keys(g.flow.states).some((s) => shownIn(n, s) && !shownIn(d, s) && stopsAfter(g, s, n.emits).some((t) => shownIn(d, t)));
|
|
54
|
+
if (opens)
|
|
55
|
+
out.push(id);
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
export function checkUi(g, warn) {
|
|
60
|
+
const nodes = g.ui.nodes;
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const [state, node] of Object.entries(g.ui.focus ?? {})) {
|
|
63
|
+
const path = ['focus', state];
|
|
64
|
+
const element = `focus/${state}`;
|
|
65
|
+
if (nodes[node] === undefined)
|
|
66
|
+
out.push({ rule: 'focus-not-shown', path, element, message: `focus.${state} names ${node}, which is no node of ui.yaml` });
|
|
67
|
+
else if (!shownIn(nodes[node], state))
|
|
68
|
+
out.push({ rule: 'focus-not-shown', path, element, message: `focus.${state} gives the focus to ${node}, which ${state} does not show: a node has focus only where it is shown (its in and unless, SPEC.md §4)` });
|
|
69
|
+
}
|
|
70
|
+
(g.ui.edges ?? []).forEach((e, i) => {
|
|
71
|
+
if (e.returnsFocus === undefined)
|
|
72
|
+
return;
|
|
73
|
+
const [dialog, node] = e.returnsFocus;
|
|
74
|
+
const path = ['edges', String(i)];
|
|
75
|
+
const element = `edges/returnsFocus/${dialog}`;
|
|
76
|
+
if (!isDialog(nodes[dialog])) {
|
|
77
|
+
const what = nodes[dialog] === undefined ? 'no node of ui.yaml' : 'not a dialog';
|
|
78
|
+
out.push({ rule: 'returns-focus-not-dialog', path, element, message: `returnsFocus starts at ${dialog}, which is ${what}: it starts at a page node whose role is dialog or alertdialog (SPEC.md §4)` });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// one node, the nodes that open the dialog, or OPENER: whichever node opens it
|
|
82
|
+
const several = Array.isArray(node) || node === OPENER;
|
|
83
|
+
const targets = node === OPENER ? openersOf(g, dialog) : Array.isArray(node) ? node : [node];
|
|
84
|
+
if (node === OPENER && targets.length === 0) {
|
|
85
|
+
out.push({ rule: 'focus-not-shown', path, element, message: `returnsFocus gives the focus of ${dialog} back to the node that opened it, but no node opens it: none sends an event that leads from a state without the dialog to one that shows it (SPEC.md §4)` });
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const into = closesInto(g, dialog);
|
|
89
|
+
for (const t of targets) {
|
|
90
|
+
const at = several ? `${element}/${t}` : element;
|
|
91
|
+
if (nodes[t] === undefined) {
|
|
92
|
+
out.push({ rule: 'focus-not-shown', path, element: at, message: `returnsFocus gives the focus of ${dialog} to ${t}, which is no node of ui.yaml` });
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (into.some((s) => shownIn(nodes[t], s)))
|
|
96
|
+
continue;
|
|
97
|
+
const where = into.length === 0 ? `the dialog ${dialog} never closes into a state the flow stops in` : `no state ${dialog} closes into shows it (${listed(into)})`;
|
|
98
|
+
const who = node === OPENER ? `back to ${t}, which opens it,` : `to ${t},`;
|
|
99
|
+
out.push({ rule: 'focus-not-shown', path, element: at, message: `returnsFocus gives the focus of ${dialog} ${who} but ${where} (SPEC.md §4)` });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
// a field's value in words of the catalog, held as every other node's words are
|
|
103
|
+
const words = (v) => {
|
|
104
|
+
for (const key of [...(v.key === undefined ? [] : [v.key]), ...(v.oneOf ?? [])]) {
|
|
105
|
+
const message = g.catalog[key];
|
|
106
|
+
if (message === undefined) {
|
|
107
|
+
warn(`catalog key ${key} is missing`);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
for (const [, p] of message.matchAll(/\{(\w+)\}/g))
|
|
111
|
+
if (g.ui.samples[p] === undefined)
|
|
112
|
+
warn(`no sample value for {${p}} in ${key}`);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
for (const n of Object.values(nodes))
|
|
116
|
+
if (n.value !== undefined)
|
|
117
|
+
words(n.value);
|
|
118
|
+
// the flow's name for its users, in the catalog of every locale, as the changes note is
|
|
119
|
+
const task = g.ui.task?.key;
|
|
120
|
+
if (g.ui.absent !== true && typeof task === 'string') {
|
|
121
|
+
for (const locale of g.ui.locales ?? [basename(g.ui.catalog, '.json')]) {
|
|
122
|
+
let catalog = null;
|
|
123
|
+
try {
|
|
124
|
+
catalog = JSON.parse(readFileSync(join(g.dir, dirname(g.ui.catalog), `${locale}.json`), 'utf8'));
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
catalog = null;
|
|
128
|
+
}
|
|
129
|
+
const name = catalog?.[task];
|
|
130
|
+
if (typeof name === 'string' && name.trim() !== '')
|
|
131
|
+
continue;
|
|
132
|
+
out.push({ rule: 'task-locale', path: ['task'], element: `task/${locale}`, message: `the flow's name for its users, ${task}, is not in the ${locale} catalog (SPEC.md §4)` });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
package/dist/wireframe.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { titleOf } from './graph.js';
|
|
1
|
+
import { shownIn, titleOf } from './graph.js';
|
|
2
2
|
import { drawWith, mark } from './kit.js';
|
|
3
3
|
const esc = (s) => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
4
4
|
function fill(g, key, warn) {
|
|
@@ -40,10 +40,21 @@ function accessibleName(g, n, warn) {
|
|
|
40
40
|
}
|
|
41
41
|
if (n.role === 'button' || n.role === 'heading' || n.role === 'status' || n.role === 'alert')
|
|
42
42
|
return texts(g, n, warn)[0];
|
|
43
|
+
// a checkbox, a radio and a select are named by their label, the words beside them (SPEC.md §4)
|
|
44
|
+
if (LABELLED.has(n.component ?? ''))
|
|
45
|
+
return texts(g, n, warn)[0];
|
|
43
46
|
return undefined;
|
|
44
47
|
}
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const LABELLED = new Set(['Checkbox', 'Radio', 'Select']);
|
|
49
|
+
// the words a field holds when it is shown (`value`), for a select the option it shows chosen
|
|
50
|
+
function valueWords(g, n, warn) {
|
|
51
|
+
const v = n.value;
|
|
52
|
+
if (v === undefined)
|
|
53
|
+
return '';
|
|
54
|
+
if (v.literal !== undefined)
|
|
55
|
+
return v.literal;
|
|
56
|
+
const key = v.key ?? v.oneOf?.[0];
|
|
57
|
+
return key === undefined ? '' : fill(g, key, warn);
|
|
47
58
|
}
|
|
48
59
|
function chips(it) {
|
|
49
60
|
const n = it.node;
|
|
@@ -52,6 +63,8 @@ function chips(it) {
|
|
|
52
63
|
parts.push(`emits ${n.emits}`);
|
|
53
64
|
if (it.disabled)
|
|
54
65
|
parts.push('disabled');
|
|
66
|
+
else if (n.disabledWhen !== undefined)
|
|
67
|
+
parts.push(`disabled when ${n.disabledWhen}`);
|
|
55
68
|
if (n.when !== undefined)
|
|
56
69
|
parts.push(`when ${n.when}`);
|
|
57
70
|
if (it.focus)
|
|
@@ -81,7 +94,7 @@ function renderWireframe(g, state, items, warn, clean = false, kit = null) {
|
|
|
81
94
|
const name = accessibleName(g, n, warn);
|
|
82
95
|
// the role the expected tree gives the node, which picks a template from the component's `roles`
|
|
83
96
|
const role = n.role ?? (n.type === 'text' ? undefined : n.type);
|
|
84
|
-
return { id: it.id, text, name: name ?? text, intent: n.intent, role, disabled: it.disabled, named: name !== undefined && name !== text, conditional: n.when !== undefined };
|
|
97
|
+
return { id: it.id, text, name: name ?? text, intent: n.intent, role, disabled: it.disabled, named: name !== undefined && name !== text, conditional: n.when !== undefined, checked: n.checked === true };
|
|
85
98
|
};
|
|
86
99
|
const drawKitList = (it, drawn) => {
|
|
87
100
|
const f = { ...fill(it, texts(g, it.node, warn)[0] ?? ''), children: drawn.map((d) => `\n${d}`).join('') + '\n' };
|
|
@@ -145,6 +158,14 @@ function renderWireframe(g, state, items, warn, clean = false, kit = null) {
|
|
|
145
158
|
// the visible text is the label; the input is named by it, as a <label> around it does
|
|
146
159
|
out.push(item(it, `<label class="wf-field"><span>${text}</span><input type="text" class="wf-input" tabindex="-1"${it.disabled ? ' disabled' : ''}></label>`));
|
|
147
160
|
break;
|
|
161
|
+
case 'Checkbox':
|
|
162
|
+
case 'Radio':
|
|
163
|
+
// the box beside its label, as a <label> around an <input> draws it
|
|
164
|
+
out.push(item(it, `<label class="wf-check"><input type="${n.component === 'Radio' ? 'radio' : 'checkbox'}" tabindex="-1"${n.checked === true ? ' checked' : ''}${it.disabled ? ' disabled' : ''}><span>${text}</span></label>`));
|
|
165
|
+
break;
|
|
166
|
+
case 'Select':
|
|
167
|
+
out.push(item(it, `<label class="wf-field"><span>${text}</span><select class="wf-input" tabindex="-1"${it.disabled ? ' disabled' : ''}><option>${esc(valueWords(g, n, warn))}</option></select></label>`));
|
|
168
|
+
break;
|
|
148
169
|
case 'List':
|
|
149
170
|
out.push(`<ul class="wf-list" data-node="${esc(it.id)}">`);
|
|
150
171
|
inList = true;
|
|
@@ -175,7 +196,7 @@ function renderTree(g, items, warn) {
|
|
|
175
196
|
for (const it of items) {
|
|
176
197
|
const n = it.node;
|
|
177
198
|
const depth = n.component === 'Page' ? 0 : n.component === 'ListItem' ? 2 : 1;
|
|
178
|
-
const flags = [it.disabled ? 'disabled' : '', n.when !== undefined ? `when ${n.when}` : '', it.focus ? 'first focus' : '', n.emits !== undefined ? `→ ${n.emits}` : '']
|
|
199
|
+
const flags = [it.disabled ? 'disabled' : n.disabledWhen !== undefined ? `disabled when ${n.disabledWhen}` : '', n.when !== undefined ? `when ${n.when}` : '', it.focus ? 'first focus' : '', n.emits !== undefined ? `→ ${n.emits}` : '']
|
|
179
200
|
.filter((f) => f !== '')
|
|
180
201
|
.join(', ');
|
|
181
202
|
const suffix = flags === '' ? '' : ` [${flags}]`;
|
package/dist/yaml.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare function lineAndColumn(text: string, offset: number): {
|
|
|
11
11
|
column: number;
|
|
12
12
|
};
|
|
13
13
|
export declare function unsupported(text: string): Unsupported | null;
|
|
14
|
+
export declare function parsingOnce<T>(run: () => T): T;
|
|
14
15
|
export declare function readYaml(text: string): unknown;
|
|
15
16
|
export declare function keyAt(text: string, path: string[]): {
|
|
16
17
|
line: number;
|
package/dist/yaml.js
CHANGED
|
@@ -68,18 +68,49 @@ function refusal(u) {
|
|
|
68
68
|
err.linePos = [{ line: u.line, col: u.column }];
|
|
69
69
|
return err;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
let read = null;
|
|
72
|
+
// `run`, with every text it reads through `readYaml` or `keyAt` parsed once; the same as `run` alone otherwise
|
|
73
|
+
export function parsingOnce(run) {
|
|
74
|
+
if (read !== null)
|
|
75
|
+
return run();
|
|
76
|
+
read = { values: new Map(), documents: new Map() };
|
|
77
|
+
try {
|
|
78
|
+
return run();
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
read = null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// the value of a graph file's text: the yaml library's `parse`, once nothing unsupported is found. Inside
|
|
85
|
+
// `parsingOnce` each call gets its own copy, so a reader that changes the value changes no other reader's.
|
|
72
86
|
export function readYaml(text) {
|
|
87
|
+
const kept = read?.values.get(text);
|
|
88
|
+
if (kept !== undefined) {
|
|
89
|
+
if ('refused' in kept)
|
|
90
|
+
throw refusal(kept.refused);
|
|
91
|
+
return structuredClone(kept.value);
|
|
92
|
+
}
|
|
73
93
|
const u = unsupported(text);
|
|
74
|
-
if (u !== null)
|
|
94
|
+
if (u !== null) {
|
|
95
|
+
read?.values.set(text, { refused: u });
|
|
75
96
|
throw refusal(u);
|
|
76
|
-
|
|
97
|
+
}
|
|
98
|
+
const value = parse(text);
|
|
99
|
+
if (read === null)
|
|
100
|
+
return value;
|
|
101
|
+
read.values.set(text, { value });
|
|
102
|
+
return structuredClone(value);
|
|
77
103
|
}
|
|
78
104
|
// the 1-based line and column of the key at `path` in a YAML text (of the item, for a list index), else the file's
|
|
79
105
|
// start; for a text `readYaml` has read
|
|
80
106
|
export function keyAt(text, path) {
|
|
81
|
-
|
|
82
|
-
|
|
107
|
+
let parsed = read?.documents.get(text);
|
|
108
|
+
if (parsed === undefined) {
|
|
109
|
+
const counter = new LineCounter();
|
|
110
|
+
parsed = { doc: parseDocument(text, { lineCounter: counter, prettyErrors: false }), lineCounter: counter };
|
|
111
|
+
read?.documents.set(text, parsed);
|
|
112
|
+
}
|
|
113
|
+
const { doc, lineCounter } = parsed;
|
|
83
114
|
const keyOf = (pair) => String(pair.key?.value ?? pair.key);
|
|
84
115
|
let node = doc.contents;
|
|
85
116
|
let at;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delurio/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "The open checker and page of delurio-graph/0: check every graph in a project's own CI, offline, with GNU error lines and SARIF.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"./expr": { "types": "./dist/expr.d.ts", "default": "./dist/expr.js" },
|
|
18
18
|
"./spine": { "types": "./dist/spine.d.ts", "default": "./dist/spine.js" },
|
|
19
19
|
"./yaml": { "types": "./dist/yaml.d.ts", "default": "./dist/yaml.js" },
|
|
20
|
+
"./needs": { "types": "./dist/needs.d.ts", "default": "./dist/needs.js" },
|
|
20
21
|
"./package.json": "./package.json"
|
|
21
22
|
},
|
|
22
23
|
"files": ["dist", "schemas", "SPEC.md", "NOTICE", "CHANGELOG.md"],
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"description": "The entity's fields, by name, each a JSON Schema (2020-12) with delurio's keywords.",
|
|
73
73
|
"additionalProperties": { "$ref": "#/$defs/field" }
|
|
74
74
|
},
|
|
75
|
-
"required": { "$ref": "#/$defs/names", "description": "The fields that must be present
|
|
76
|
-
"key": { "$ref": "#/$defs/names", "description": "The fields that identify the entity
|
|
75
|
+
"required": { "$ref": "#/$defs/names", "description": "The fields that must be present, each one of its `fields`." },
|
|
76
|
+
"key": { "$ref": "#/$defs/names", "description": "The fields that identify the entity, each one of its `fields`; `[id]` when left out.", "examples": [["userId", "clientId"]] },
|
|
77
77
|
"lifecycle": {
|
|
78
78
|
"type": "array",
|
|
79
79
|
"description": "The entity's states, as `from -> to: why` sentences. Quote each: an unquoted item that contains `: ` is read as a map.",
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
"contentMediaType": { "type": "string", "description": "JSON Schema: the media type of the string's content.", "examples": ["text/calendar", "application/json"] },
|
|
194
194
|
"contentSchema": { "$ref": "#/$defs/schema", "description": "JSON Schema: the schema of the string's decoded content." },
|
|
195
195
|
|
|
196
|
-
"references": { "type": "string", "description": "delurio: the field holds the key of this other entity." },
|
|
196
|
+
"references": { "type": "string", "description": "delurio: the field holds the key of this other entity, one of the domain's own (SPEC.md §5)." },
|
|
197
197
|
"unique": {
|
|
198
198
|
"description": "delurio: no two entities have the same value: `true`, or `case-insensitive`.",
|
|
199
199
|
"enum": [true, "case-insensitive"]
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
"description": "The action's response: `returns` an entity, a `redirect`, a `status`, or a JSON Schema.",
|
|
253
253
|
"$ref": "#/$defs/keywords",
|
|
254
254
|
"properties": {
|
|
255
|
-
"returns": { "type": "string", "description": "The entity the action returns." },
|
|
255
|
+
"returns": { "type": "string", "description": "The entity the action returns, one of the domain's own (SPEC.md §5)." },
|
|
256
256
|
"redirect": { "type": "string", "description": "Where the response redirects, in words or as a path." },
|
|
257
257
|
"status": { "type": "integer", "minimum": 100, "maximum": 599, "description": "The HTTP status of the response." }
|
|
258
258
|
},
|
|
@@ -283,9 +283,9 @@
|
|
|
283
283
|
"actor": { "type": "string", "description": "Who the policy is for.", "examples": ["end-user", "anyone", "agent"] },
|
|
284
284
|
"needs": { "type": "string", "description": "What the actor must hold.", "examples": ["session"] },
|
|
285
285
|
"where": { "type": "string", "description": "The condition under which it holds, in words." },
|
|
286
|
-
"read": { "$ref": "#/$defs/names", "description": "The entities the actor may read." },
|
|
287
|
-
"write": { "$ref": "#/$defs/names", "description": "The entities the actor may write." },
|
|
288
|
-
"do": { "$ref": "#/$defs/names", "description": "The actions the actor may invoke." },
|
|
286
|
+
"read": { "$ref": "#/$defs/names", "description": "The entities of the domain the actor may read." },
|
|
287
|
+
"write": { "$ref": "#/$defs/names", "description": "The entities of the domain the actor may write." },
|
|
288
|
+
"do": { "$ref": "#/$defs/names", "description": "The actions of the domain the actor may invoke." },
|
|
289
289
|
"source": { "$ref": "#/$defs/sourceAnchor" }
|
|
290
290
|
}
|
|
291
291
|
},
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unpkg.com/@delurio/cli@0.9.0/schemas/gaps.schema.json",
|
|
4
|
+
"title": "delurio gaps of a product (needs.gaps.yaml)",
|
|
5
|
+
"description": "Every need of a product's flows that is missing, by the flow's id and the need's id, in delurio-graph/0 (SPEC.md §13). It sits at the root of the product's graphs and covers the flows under its folder. A need that is missing and not listed here fails the check, and so does an entry whose need is met: the list only shrinks on its own.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["schema", "kind", "id", "gaps"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema": {
|
|
11
|
+
"description": "The format and its version. Every graph file starts with it.",
|
|
12
|
+
"const": "delurio-graph/0"
|
|
13
|
+
},
|
|
14
|
+
"kind": { "description": "The kind of graph file. A needs.gaps.yaml is `gaps`.", "const": "gaps" },
|
|
15
|
+
"id": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The product's id, as its flows' ids begin.",
|
|
18
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
|
|
19
|
+
"examples": ["example.notes"]
|
|
20
|
+
},
|
|
21
|
+
"title": { "type": "string", "description": "The list in plain words, for people." },
|
|
22
|
+
"summary": { "type": "string", "description": "What the gaps are, in a few plain sentences: the phases still to come, for instance." },
|
|
23
|
+
"status": {
|
|
24
|
+
"description": "`proposed`: written, nobody has approved it. `approved`: the owner reviewed and accepted the list.",
|
|
25
|
+
"enum": ["proposed", "approved"]
|
|
26
|
+
},
|
|
27
|
+
"gaps": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"description": "The needs that are missing, by flow id: each a list of need ids, every one of them a need of that flow's needs.yaml that says `missing`. Empty when every need is met.",
|
|
30
|
+
"propertyNames": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "A flow's id, as its needs.yaml gives it.",
|
|
33
|
+
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
|
|
34
|
+
},
|
|
35
|
+
"additionalProperties": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"description": "The ids of the flow's needs that are missing.",
|
|
38
|
+
"minItems": 1,
|
|
39
|
+
"uniqueItems": true,
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "A need's id: kebab-case.",
|
|
43
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"examples": [{ "example.restoreNote": ["says-when-it-is-erased"] }]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
package/schemas/nav.schema.json
CHANGED
|
@@ -146,19 +146,46 @@
|
|
|
146
146
|
"commit": { "type": "string", "description": "The commit the extractor read." },
|
|
147
147
|
"app": { "type": "string", "description": "The application's folder in the repository." },
|
|
148
148
|
"menu": { "type": "string", "description": "The file that holds the menus." },
|
|
149
|
-
"locales": {
|
|
149
|
+
"locales": {
|
|
150
|
+
"description": "The application's message file, or a list of every file it reads; `{locale}` stands for the locale in each path (SPEC.md §6).",
|
|
151
|
+
"anyOf": [
|
|
152
|
+
{ "type": "string" },
|
|
153
|
+
{ "type": "array", "minItems": 1, "items": { "type": "string" } }
|
|
154
|
+
],
|
|
155
|
+
"examples": ["messages/{locale}.json", ["libs/i18n/locales/{locale}/web.json", "libs/i18n/locales/{locale}/common.json"]]
|
|
156
|
+
}
|
|
150
157
|
},
|
|
151
158
|
"additionalProperties": { "type": "string", "description": "Another file or folder of the application the graph was read from." }
|
|
152
159
|
},
|
|
153
160
|
"extract": {
|
|
154
161
|
"type": "object",
|
|
155
|
-
"description": "How the extractor reads the application: its adapter, the names it gives to pages that no menu entry names, the titles it takes,
|
|
162
|
+
"description": "How the extractor reads the application: its adapter, the names it gives to pages that no menu entry names, the titles it takes, the locales it copies into catalog/, and the fields it lays over the entries it generates.",
|
|
156
163
|
"additionalProperties": false,
|
|
157
164
|
"properties": {
|
|
158
165
|
"adapter": { "type": "string", "description": "The extractor adapter for this application." },
|
|
159
166
|
"names": { "type": "object", "description": "Route to page id, for pages that no menu entry names.", "additionalProperties": { "type": "string", "description": "The page id." } },
|
|
160
167
|
"titles": { "type": "object", "description": "Page id to the catalog key of its title.", "additionalProperties": { "type": "string", "description": "The catalog key." } },
|
|
161
|
-
"locales": { "type": "array", "description": "The locales copied into catalog/, as BCP 47 tags.", "items": { "$ref": "#/$defs/locale" } }
|
|
168
|
+
"locales": { "type": "array", "description": "The locales copied into catalog/, as BCP 47 tags.", "items": { "$ref": "#/$defs/locale" } },
|
|
169
|
+
"entries": {
|
|
170
|
+
"type": "object",
|
|
171
|
+
"description": "Fields laid over a generated entry, which nav.yaml cannot change otherwise, keyed by the entry's ends as it is cited: `<from>-><to>`, followed by its how or its label where two share their ends (SPEC.md §6).",
|
|
172
|
+
"propertyNames": { "pattern": "^(frame:[\\w-]+|[\\w-]+)->[\\w-]+( \\S+)?$" },
|
|
173
|
+
"additionalProperties": {
|
|
174
|
+
"type": "object",
|
|
175
|
+
"description": "The fields laid over the entry, or skip with the reason it is left out.",
|
|
176
|
+
"additionalProperties": false,
|
|
177
|
+
"properties": {
|
|
178
|
+
"when": { "$ref": "#/$defs/expression", "description": "The guard under which the entry is offered." },
|
|
179
|
+
"data": { "type": "boolean", "description": "`true` when it needs an item to exist (a row to click)." },
|
|
180
|
+
"label": { "type": "string", "description": "Its words: a catalog key, or plain words." },
|
|
181
|
+
"how": { "$ref": "#/$defs/entry/properties/how" },
|
|
182
|
+
"back": { "type": "boolean", "description": "`true` for a way back." },
|
|
183
|
+
"clicks": { "type": "integer", "minimum": 0, "description": "How many clicks it takes." },
|
|
184
|
+
"skip": { "type": "string", "minLength": 1, "description": "Why the generated entry is left out." }
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"examples": [{ "home->discover": { "when": "not signedIn" }, "frame:none->privacy": { "skip": "the privacy page links to itself" } }]
|
|
188
|
+
}
|
|
162
189
|
}
|
|
163
190
|
},
|
|
164
191
|
"guards": {
|
|
@@ -232,6 +259,10 @@
|
|
|
232
259
|
"frame": { "type": "string", "description": "The frame drawn around the page." },
|
|
233
260
|
"opensFor": { "$ref": "#/$defs/expression", "description": "The guard under which the page opens; it refuses everyone else." },
|
|
234
261
|
"refusal": { "type": "string", "description": "How the page says no, in words." },
|
|
262
|
+
"byAddress": {
|
|
263
|
+
"type": "boolean",
|
|
264
|
+
"description": "People open the page by its address, typed or followed from outside the app (a link in an e-mail, a sign-in another site sends them to), as nothing in the app links to it: a persona no entry brings there reaches it so, with no clicks, and it is not unreachable (SPEC.md §6)."
|
|
265
|
+
},
|
|
235
266
|
"pageCodes": { "type": "string", "description": "Generated: the name of the permission codes that open the page, as the application's permission table names them." },
|
|
236
267
|
"evidence": { "type": "string", "description": "The code that shows the page's kind or gate, in words." },
|
|
237
268
|
"source": { "$ref": "#/$defs/sourceAnchor" }
|