@graview/core 0.1.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/LICENSE +96 -0
- package/README.md +35 -0
- package/dist/app.d.ts +294 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +49 -0
- package/dist/app.js.map +1 -0
- package/dist/arrange.d.ts +185 -0
- package/dist/arrange.d.ts.map +1 -0
- package/dist/arrange.js +456 -0
- package/dist/arrange.js.map +1 -0
- package/dist/beginning.d.ts +65 -0
- package/dist/beginning.d.ts.map +1 -0
- package/dist/beginning.js +94 -0
- package/dist/beginning.js.map +1 -0
- package/dist/bind.d.ts +42 -0
- package/dist/bind.d.ts.map +1 -0
- package/dist/bind.js +26 -0
- package/dist/bind.js.map +1 -0
- package/dist/city.d.ts +93 -0
- package/dist/city.d.ts.map +1 -0
- package/dist/city.js +160 -0
- package/dist/city.js.map +1 -0
- package/dist/cli/check/arrangement.d.ts +13 -0
- package/dist/cli/check/arrangement.d.ts.map +1 -0
- package/dist/cli/check/arrangement.js +63 -0
- package/dist/cli/check/arrangement.js.map +1 -0
- package/dist/cli/check/beginnings.d.ts +16 -0
- package/dist/cli/check/beginnings.d.ts.map +1 -0
- package/dist/cli/check/beginnings.js +53 -0
- package/dist/cli/check/beginnings.js.map +1 -0
- package/dist/cli/check/brand.d.ts +17 -0
- package/dist/cli/check/brand.d.ts.map +1 -0
- package/dist/cli/check/brand.js +153 -0
- package/dist/cli/check/brand.js.map +1 -0
- package/dist/cli/check/city.d.ts +17 -0
- package/dist/cli/check/city.d.ts.map +1 -0
- package/dist/cli/check/city.js +58 -0
- package/dist/cli/check/city.js.map +1 -0
- package/dist/cli/check/context.d.ts +50 -0
- package/dist/cli/check/context.d.ts.map +1 -0
- package/dist/cli/check/context.js +37 -0
- package/dist/cli/check/context.js.map +1 -0
- package/dist/cli/check/fields.d.ts +16 -0
- package/dist/cli/check/fields.d.ts.map +1 -0
- package/dist/cli/check/fields.js +237 -0
- package/dist/cli/check/fields.js.map +1 -0
- package/dist/cli/check/index.d.ts +14 -0
- package/dist/cli/check/index.d.ts.map +1 -0
- package/dist/cli/check/index.js +14 -0
- package/dist/cli/check/index.js.map +1 -0
- package/dist/cli/check/intelligence.d.ts +17 -0
- package/dist/cli/check/intelligence.d.ts.map +1 -0
- package/dist/cli/check/intelligence.js +136 -0
- package/dist/cli/check/intelligence.js.map +1 -0
- package/dist/cli/check/lenses.d.ts +17 -0
- package/dist/cli/check/lenses.d.ts.map +1 -0
- package/dist/cli/check/lenses.js +239 -0
- package/dist/cli/check/lenses.js.map +1 -0
- package/dist/cli/check/migrations.d.ts +16 -0
- package/dist/cli/check/migrations.d.ts.map +1 -0
- package/dist/cli/check/migrations.js +43 -0
- package/dist/cli/check/migrations.js.map +1 -0
- package/dist/cli/check/modules.d.ts +16 -0
- package/dist/cli/check/modules.d.ts.map +1 -0
- package/dist/cli/check/modules.js +123 -0
- package/dist/cli/check/modules.js.map +1 -0
- package/dist/cli/check/policy.d.ts +16 -0
- package/dist/cli/check/policy.d.ts.map +1 -0
- package/dist/cli/check/policy.js +90 -0
- package/dist/cli/check/policy.js.map +1 -0
- package/dist/cli/check/relations.d.ts +29 -0
- package/dist/cli/check/relations.d.ts.map +1 -0
- package/dist/cli/check/relations.js +279 -0
- package/dist/cli/check/relations.js.map +1 -0
- package/dist/cli/check/routes.d.ts +16 -0
- package/dist/cli/check/routes.d.ts.map +1 -0
- package/dist/cli/check/routes.js +31 -0
- package/dist/cli/check/routes.js.map +1 -0
- package/dist/cli/check/settings.d.ts +16 -0
- package/dist/cli/check/settings.d.ts.map +1 -0
- package/dist/cli/check/settings.js +81 -0
- package/dist/cli/check/settings.js.map +1 -0
- package/dist/cli/check.d.ts +36 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +76 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/create.d.ts +20 -0
- package/dist/cli/create.d.ts.map +1 -0
- package/dist/cli/create.js +251 -0
- package/dist/cli/create.js.map +1 -0
- package/dist/cli/describe.d.ts +35 -0
- package/dist/cli/describe.d.ts.map +1 -0
- package/dist/cli/describe.js +230 -0
- package/dist/cli/describe.js.map +1 -0
- package/dist/cli/docs.d.ts +11 -0
- package/dist/cli/docs.d.ts.map +1 -0
- package/dist/cli/docs.js +152 -0
- package/dist/cli/docs.js.map +1 -0
- package/dist/cli/index.d.ts +18 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +281 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/extend.d.ts +23 -0
- package/dist/extend.d.ts.map +1 -0
- package/dist/extend.js +53 -0
- package/dist/extend.js.map +1 -0
- package/dist/graph/diff.d.ts +31 -0
- package/dist/graph/diff.d.ts.map +1 -0
- package/dist/graph/diff.js +71 -0
- package/dist/graph/diff.js.map +1 -0
- package/dist/graph/graph.d.ts +69 -0
- package/dist/graph/graph.d.ts.map +1 -0
- package/dist/graph/graph.js +284 -0
- package/dist/graph/graph.js.map +1 -0
- package/dist/graph/primitives.d.ts +52 -0
- package/dist/graph/primitives.d.ts.map +1 -0
- package/dist/graph/primitives.js +62 -0
- package/dist/graph/primitives.js.map +1 -0
- package/dist/graph/tracked.d.ts +31 -0
- package/dist/graph/tracked.d.ts.map +1 -0
- package/dist/graph/tracked.js +69 -0
- package/dist/graph/tracked.js.map +1 -0
- package/dist/graph/types.d.ts +34 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +0 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/installation.d.ts +112 -0
- package/dist/installation.d.ts.map +1 -0
- package/dist/installation.js +193 -0
- package/dist/installation.js.map +1 -0
- package/dist/intelligence-bridge.d.ts +73 -0
- package/dist/intelligence-bridge.d.ts.map +1 -0
- package/dist/intelligence-bridge.js +31 -0
- package/dist/intelligence-bridge.js.map +1 -0
- package/dist/invariants/engine.d.ts +36 -0
- package/dist/invariants/engine.d.ts.map +1 -0
- package/dist/invariants/engine.js +88 -0
- package/dist/invariants/engine.js.map +1 -0
- package/dist/invariants/types.d.ts +75 -0
- package/dist/invariants/types.d.ts.map +1 -0
- package/dist/invariants/types.js +2 -0
- package/dist/invariants/types.js.map +1 -0
- package/dist/modules.d.ts +75 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +87 -0
- package/dist/modules.js.map +1 -0
- package/dist/mutations/decidable.d.ts +26 -0
- package/dist/mutations/decidable.d.ts.map +1 -0
- package/dist/mutations/decidable.js +39 -0
- package/dist/mutations/decidable.js.map +1 -0
- package/dist/mutations/define-mutation.d.ts +32 -0
- package/dist/mutations/define-mutation.d.ts.map +1 -0
- package/dist/mutations/define-mutation.js +181 -0
- package/dist/mutations/define-mutation.js.map +1 -0
- package/dist/mutations/derive-edits.d.ts +75 -0
- package/dist/mutations/derive-edits.d.ts.map +1 -0
- package/dist/mutations/derive-edits.js +240 -0
- package/dist/mutations/derive-edits.js.map +1 -0
- package/dist/mutations/form.d.ts +63 -0
- package/dist/mutations/form.d.ts.map +1 -0
- package/dist/mutations/form.js +113 -0
- package/dist/mutations/form.js.map +1 -0
- package/dist/mutations/node-ref.d.ts +83 -0
- package/dist/mutations/node-ref.d.ts.map +1 -0
- package/dist/mutations/node-ref.js +113 -0
- package/dist/mutations/node-ref.js.map +1 -0
- package/dist/mutations/types.d.ts +136 -0
- package/dist/mutations/types.d.ts.map +1 -0
- package/dist/mutations/types.js +2 -0
- package/dist/mutations/types.js.map +1 -0
- package/dist/ops/log.d.ts +35 -0
- package/dist/ops/log.d.ts.map +1 -0
- package/dist/ops/log.js +103 -0
- package/dist/ops/log.js.map +1 -0
- package/dist/ops/types.d.ts +52 -0
- package/dist/ops/types.d.ts.map +1 -0
- package/dist/ops/types.js +2 -0
- package/dist/ops/types.js.map +1 -0
- package/dist/ops/undo.d.ts +33 -0
- package/dist/ops/undo.d.ts.map +1 -0
- package/dist/ops/undo.js +65 -0
- package/dist/ops/undo.js.map +1 -0
- package/dist/permissions/policy.d.ts +68 -0
- package/dist/permissions/policy.d.ts.map +1 -0
- package/dist/permissions/policy.js +191 -0
- package/dist/permissions/policy.js.map +1 -0
- package/dist/permissions/types.d.ts +78 -0
- package/dist/permissions/types.d.ts.map +1 -0
- package/dist/permissions/types.js +17 -0
- package/dist/permissions/types.js.map +1 -0
- package/dist/persistence/memory.d.ts +6 -0
- package/dist/persistence/memory.d.ts.map +1 -0
- package/dist/persistence/memory.js +31 -0
- package/dist/persistence/memory.js.map +1 -0
- package/dist/persistence/sqlite.d.ts +59 -0
- package/dist/persistence/sqlite.d.ts.map +1 -0
- package/dist/persistence/sqlite.js +131 -0
- package/dist/persistence/sqlite.js.map +1 -0
- package/dist/persistence/types.d.ts +22 -0
- package/dist/persistence/types.d.ts.map +1 -0
- package/dist/persistence/types.js +2 -0
- package/dist/persistence/types.js.map +1 -0
- package/dist/presence.d.ts +38 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +50 -0
- package/dist/presence.js.map +1 -0
- package/dist/scaffold/domain.d.ts +8 -0
- package/dist/scaffold/domain.d.ts.map +1 -0
- package/dist/scaffold/domain.js +331 -0
- package/dist/scaffold/domain.js.map +1 -0
- package/dist/scaffold/index.d.ts +66 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/index.js +142 -0
- package/dist/scaffold/index.js.map +1 -0
- package/dist/scaffold/lens.d.ts +31 -0
- package/dist/scaffold/lens.d.ts.map +1 -0
- package/dist/scaffold/lens.js +176 -0
- package/dist/scaffold/lens.js.map +1 -0
- package/dist/scaffold/names.d.ts +44 -0
- package/dist/scaffold/names.d.ts.map +1 -0
- package/dist/scaffold/names.js +69 -0
- package/dist/scaffold/names.js.map +1 -0
- package/dist/scaffold/project.d.ts +41 -0
- package/dist/scaffold/project.d.ts.map +1 -0
- package/dist/scaffold/project.js +604 -0
- package/dist/scaffold/project.js.map +1 -0
- package/dist/scaffold/ui.d.ts +15 -0
- package/dist/scaffold/ui.d.ts.map +1 -0
- package/dist/scaffold/ui.js +536 -0
- package/dist/scaffold/ui.js.map +1 -0
- package/dist/schema/define-node.d.ts +132 -0
- package/dist/schema/define-node.d.ts.map +1 -0
- package/dist/schema/define-node.js +254 -0
- package/dist/schema/define-node.js.map +1 -0
- package/dist/schema/figures.d.ts +42 -0
- package/dist/schema/figures.d.ts.map +1 -0
- package/dist/schema/figures.js +220 -0
- package/dist/schema/figures.js.map +1 -0
- package/dist/schema/json-schema.d.ts +39 -0
- package/dist/schema/json-schema.d.ts.map +1 -0
- package/dist/schema/json-schema.js +74 -0
- package/dist/schema/json-schema.js.map +1 -0
- package/dist/schema/schema.d.ts +43 -0
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/schema/schema.js +102 -0
- package/dist/schema/schema.js.map +1 -0
- package/dist/schema/types.d.ts +201 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +2 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/search.d.ts +215 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +449 -0
- package/dist/search.js.map +1 -0
- package/dist/settings.d.ts +30 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +74 -0
- package/dist/settings.js.map +1 -0
- package/dist/store.d.ts +284 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +660 -0
- package/dist/store.js.map +1 -0
- package/dist/studio-door.d.ts +187 -0
- package/dist/studio-door.d.ts.map +1 -0
- package/dist/studio-door.js +20 -0
- package/dist/studio-door.js.map +1 -0
- package/dist/sync/conflict.d.ts +37 -0
- package/dist/sync/conflict.d.ts.map +1 -0
- package/dist/sync/conflict.js +56 -0
- package/dist/sync/conflict.js.map +1 -0
- package/dist/sync/engine.d.ts +118 -0
- package/dist/sync/engine.d.ts.map +1 -0
- package/dist/sync/engine.js +341 -0
- package/dist/sync/engine.js.map +1 -0
- package/dist/sync/google-calendar.d.ts +54 -0
- package/dist/sync/google-calendar.d.ts.map +1 -0
- package/dist/sync/google-calendar.js +167 -0
- package/dist/sync/google-calendar.js.map +1 -0
- package/dist/sync/types.d.ts +125 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/types.js +6 -0
- package/dist/sync/types.js.map +1 -0
- package/dist/temporal/effectivity.d.ts +75 -0
- package/dist/temporal/effectivity.d.ts.map +1 -0
- package/dist/temporal/effectivity.js +89 -0
- package/dist/temporal/effectivity.js.map +1 -0
- package/dist/testing.d.ts +63 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +194 -0
- package/dist/testing.js.map +1 -0
- package/dist/theme/contrast.d.ts +47 -0
- package/dist/theme/contrast.d.ts.map +1 -0
- package/dist/theme/contrast.js +172 -0
- package/dist/theme/contrast.js.map +1 -0
- package/dist/theme/derive.d.ts +81 -0
- package/dist/theme/derive.d.ts.map +1 -0
- package/dist/theme/derive.js +171 -0
- package/dist/theme/derive.js.map +1 -0
- package/dist/theme/kit.d.ts +106 -0
- package/dist/theme/kit.d.ts.map +1 -0
- package/dist/theme/kit.js +84 -0
- package/dist/theme/kit.js.map +1 -0
- package/dist/theme/palettes.d.ts +32 -0
- package/dist/theme/palettes.d.ts.map +1 -0
- package/dist/theme/palettes.js +96 -0
- package/dist/theme/palettes.js.map +1 -0
- package/dist/theme/types.d.ts +131 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +23 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/views/types.d.ts +89 -0
- package/dist/views/types.d.ts.map +1 -0
- package/dist/views/types.js +88 -0
- package/dist/views/types.js.map +1 -0
- package/dist/watched.d.ts +33 -0
- package/dist/watched.d.ts.map +1 -0
- package/dist/watched.js +50 -0
- package/dist/watched.js.map +1 -0
- package/dist/who.d.ts +26 -0
- package/dist/who.d.ts.map +1 -0
- package/dist/who.js +20 -0
- package/dist/who.js.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../../src/cli/check/brand.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CA2B5E;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CA2H5E"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { checkBrandContrast } from "../../theme/derive.js";
|
|
2
|
+
import { checkKitContrast, resolveKit } from "../../theme/kit.js";
|
|
3
|
+
export function checkAccents(ctx) {
|
|
4
|
+
const { app, kinds, add } = ctx;
|
|
5
|
+
/*
|
|
6
|
+
* A declared kind accent must name a declared kind. A typo here would not
|
|
7
|
+
* fail — it would quietly fall back to the hash, which is the worst kind
|
|
8
|
+
* of wrong: a brand decision that looks applied and is not.
|
|
9
|
+
*/
|
|
10
|
+
for (const [kind, hue] of Object.entries(app.brand?.accents ?? {})) {
|
|
11
|
+
if (!kinds.has(kind)) {
|
|
12
|
+
add({
|
|
13
|
+
severity: "error",
|
|
14
|
+
code: "brand-accent-unknown-kind",
|
|
15
|
+
where: `brand.accents["${kind}"]`,
|
|
16
|
+
message: `An accent is declared for "${kind}", which no defineNode declares.`,
|
|
17
|
+
fix: `Fix the kind name, or remove the entry. Declared: ${[...kinds].join(", ")}.`,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (typeof hue !== "number" || !Number.isFinite(hue)) {
|
|
21
|
+
add({
|
|
22
|
+
severity: "error",
|
|
23
|
+
code: "brand-accent-not-a-hue",
|
|
24
|
+
where: `brand.accents["${kind}"]`,
|
|
25
|
+
message: `The accent must be a hue in degrees (a number), got ${JSON.stringify(hue)}.`,
|
|
26
|
+
fix: `Use a number 0–360, e.g. 152 for a green.`,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function checkPalette(ctx) {
|
|
32
|
+
const { app, kinds, add } = ctx;
|
|
33
|
+
/*
|
|
34
|
+
* A palette that cannot be read.
|
|
35
|
+
*
|
|
36
|
+
* The two shipped schemes are not inversions of each other, and a brand
|
|
37
|
+
* that supplies one colour and lets the rest be derived can end up with
|
|
38
|
+
* text that clears AA in the dark and fails badly on paper. Contrast is
|
|
39
|
+
* measurable, so it is checked rather than trusted — and the failure names
|
|
40
|
+
* the exact token PAIR and where it is drawn, because "your theme has a
|
|
41
|
+
* contrast problem" is not something anyone can act on.
|
|
42
|
+
*/
|
|
43
|
+
if (app.brand) {
|
|
44
|
+
for (const finding of checkBrandContrast(app.brand.schemes)) {
|
|
45
|
+
if (finding.unreadable !== undefined) {
|
|
46
|
+
add({
|
|
47
|
+
severity: "warning",
|
|
48
|
+
code: "theme-token-unreadable",
|
|
49
|
+
where: `brand.schemes.${finding.scheme}.${finding.on === finding.ink ? finding.ink : finding.on}`,
|
|
50
|
+
message: `Could not read "${finding.unreadable}" as a colour, so the pair ${finding.ink} on ${finding.on} was not checked.`,
|
|
51
|
+
fix: "Use a hex, rgb() or hsl() value, or a gradient built from them.",
|
|
52
|
+
});
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
add({
|
|
56
|
+
severity: "error",
|
|
57
|
+
code: "theme-contrast-below-aa",
|
|
58
|
+
where: `brand.schemes.${finding.scheme}: ${finding.ink} on ${finding.on}`,
|
|
59
|
+
message: `${finding.ratio}:1 where ${finding.requires}:1 is required — ${finding.where}.`,
|
|
60
|
+
fix: `Darken or lighten "${finding.ink}", or change the ground it sits on.`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/*
|
|
64
|
+
* The kit's colours are held to the same standard as the text's, at the
|
|
65
|
+
* graphics floor: a line a brand paints explicitly must be told from
|
|
66
|
+
* the ground it crosses, on both grounds, in both schemes.
|
|
67
|
+
*/
|
|
68
|
+
if (app.brand.kit) {
|
|
69
|
+
const kit = resolveKit(app.brand.kit);
|
|
70
|
+
const unreadable = new Set();
|
|
71
|
+
for (const scheme of Object.keys(app.brand.schemes)) {
|
|
72
|
+
for (const finding of checkKitContrast(kit, app.brand.schemes[scheme])) {
|
|
73
|
+
const where = `brand.kit.connectors.${finding.edgeKind === "*" ? "all" : `byEdge.${finding.edgeKind}`}.colour`;
|
|
74
|
+
if (finding.unreadable !== undefined) {
|
|
75
|
+
if (unreadable.has(where))
|
|
76
|
+
continue;
|
|
77
|
+
unreadable.add(where);
|
|
78
|
+
add({
|
|
79
|
+
severity: "warning",
|
|
80
|
+
code: "kit-colour-unreadable",
|
|
81
|
+
where,
|
|
82
|
+
message: `Could not read "${finding.unreadable}" as a colour, so the line was not checked against the ground.`,
|
|
83
|
+
fix: "Use a hex, rgb() or hsl() value.",
|
|
84
|
+
});
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
add({
|
|
88
|
+
severity: "error",
|
|
89
|
+
code: "kit-contrast-below-aa",
|
|
90
|
+
where: `${where} in ${scheme}`,
|
|
91
|
+
// WHICH ground: the same line fails the scene's ground and the deeper one under a district, and two errors saying "the ground" read as one said twice.
|
|
92
|
+
message: `${finding.ratio}:1 against the ${finding.ground ?? "ground"} of the ${scheme} scheme, where ${finding.requires}:1 is required for a line to be seen.`,
|
|
93
|
+
fix: `Darken or lighten "${finding.colour}", or drop it and let the kind's own hue paint the line.`,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (app.brand.name.trim().length === 0) {
|
|
99
|
+
add({
|
|
100
|
+
severity: "warning",
|
|
101
|
+
code: "brand-unnamed",
|
|
102
|
+
where: "brand.name",
|
|
103
|
+
message: "An installation with no name shows the framework's wordmark instead of yours.",
|
|
104
|
+
fix: "Set brand.name to the product name.",
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// A node kind whose declaration demands an invariant nobody wrote will
|
|
109
|
+
// silently skip at runtime. That is the right default for evaluation but
|
|
110
|
+
// the wrong default for a build.
|
|
111
|
+
for (const definition of app.schema.definitions) {
|
|
112
|
+
if (!definition.requiresInvariant)
|
|
113
|
+
continue;
|
|
114
|
+
const covered = new Set((app.invariants ?? [])
|
|
115
|
+
.filter((i) => i.scope !== "graph" && i.scope.kind === definition.kind)
|
|
116
|
+
.map((i) => i.name));
|
|
117
|
+
if (covered.size === 0) {
|
|
118
|
+
add({
|
|
119
|
+
severity: "warning",
|
|
120
|
+
code: "required-invariant-unregistered",
|
|
121
|
+
where: `defineNode("${definition.kind}").requiresInvariant`,
|
|
122
|
+
message: `"${definition.kind}" declares that its nodes require an invariant, but none is registered for that kind.`,
|
|
123
|
+
fix: `Add a defineInvariant scoped to "${definition.kind}", or drop requiresInvariant.`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (app.views) {
|
|
128
|
+
const withViews = new Set(app.views.kindsWithViews());
|
|
129
|
+
for (const kind of kinds) {
|
|
130
|
+
if (!withViews.has(kind)) {
|
|
131
|
+
add({
|
|
132
|
+
severity: "warning",
|
|
133
|
+
code: "kind-without-view",
|
|
134
|
+
where: `defineNode("${kind}")`,
|
|
135
|
+
message: `No view is registered for "${kind}" — it will fall back to a primitive.`,
|
|
136
|
+
fix: `Register a view with views.register("${kind}", { cardinality, fidelity }, Component), or accept the primitive fallback.`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
for (const registration of app.views.all()) {
|
|
141
|
+
if (!kinds.has(registration.kind)) {
|
|
142
|
+
add({
|
|
143
|
+
severity: "error",
|
|
144
|
+
code: "view-for-undeclared-kind",
|
|
145
|
+
where: `views.register("${registration.kind}", ...)`,
|
|
146
|
+
message: `A view is registered for "${registration.kind}", which no defineNode declares.`,
|
|
147
|
+
fix: `Declare the kind, or remove the view registration.`,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=brand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.js","sourceRoot":"","sources":["../../../src/cli/check/brand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAkBlE,MAAM,UAAU,YAAY,CAAsB,GAAoB;IACpE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAChC;;;;OAIG;IACH,KAAK,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,GAAG,CAAC;gBACF,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,2BAA2B;gBACjC,KAAK,EAAE,kBAAkB,IAAI,IAAI;gBACjC,OAAO,EAAE,8BAA8B,IAAI,kCAAkC;gBAC7E,GAAG,EAAE,qDAAqD,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;aACnF,CAAC,CAAC;QACL,CAAC;QACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,GAAG,CAAC;gBACF,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,wBAAwB;gBAC9B,KAAK,EAAE,kBAAkB,IAAI,IAAI;gBACjC,OAAO,EAAE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AS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC;QACtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,GAAG,CAAC;oBACF,QAAQ,EAAE,SAAS;oBACnB,IAAI,EAAE,mBAAmB;oBACzB,KAAK,EAAE,eAAe,IAAI,IAAI;oBAC9B,OAAO,EAAE,8BAA8B,IAAI,uCAAuC;oBAClF,GAAG,EAAE,wCAAwC,IAAI,6EAA6E;iBAC/H,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,KAAK,MAAM,YAAY,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBAClC,GAAG,CAAC;oBACF,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,0BAA0B;oBAChC,KAAK,EAAE,mBAAmB,YAAY,CAAC,IAAI,SAAS;oBACpD,OAAO,EAAE,6BAA6B,YAAY,CAAC,IAAI,kCAAkC;oBACzF,GAAG,EAAE,oDAAoD;iBAC1D,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AnySchema } from "../../schema/schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* `note` is a QUESTION ASKED OUT LOUD, not a problem.
|
|
4
|
+
*
|
|
5
|
+
* Some things a checker can see are legitimate designs that the author
|
|
6
|
+
* should nonetheless have looked at once: a lens written for this app and
|
|
7
|
+
* never proved against another domain, a role name two vocabularies both
|
|
8
|
+
* use, a kind unreachable on an empty graph. Filed as warnings they would
|
|
9
|
+
* be warnings that can only ever be acknowledged, and those are the ones
|
|
10
|
+
* people learn to scroll past — which costs the checker its authority on
|
|
11
|
+
* the warnings that matter. So they have their own voice: counted, printed,
|
|
12
|
+
* and never a failure.
|
|
13
|
+
*/
|
|
14
|
+
import type { CheckContext } from "./context.js";
|
|
15
|
+
export declare function checkPlots<S extends AnySchema>(ctx: CheckContext<S>): void;
|
|
16
|
+
export declare function checkFigures<S extends AnySchema>(ctx: CheckContext<S>): void;
|
|
17
|
+
//# sourceMappingURL=city.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"city.d.ts","sourceRoot":"","sources":["../../../src/cli/check/city.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAsB1E;AAED,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CA6B5E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BLOCK, plotsOverlap } from "../../city.js";
|
|
2
|
+
import { figureFaults, FIGURE_NAMES } from "../../schema/figures.js";
|
|
3
|
+
export function checkPlots(ctx) {
|
|
4
|
+
const { app, add } = ctx;
|
|
5
|
+
/*
|
|
6
|
+
* TWO KINDS ON ONE BLOCK. A hand-laid plot is used verbatim, so two kinds
|
|
7
|
+
* laid on the same block would be drawn on top of each other, and which
|
|
8
|
+
* one answers a click would be whichever was drawn second.
|
|
9
|
+
*/
|
|
10
|
+
const laid = app.schema.definitions.filter((definition) => definition.plot !== undefined);
|
|
11
|
+
for (let i = 0; i < laid.length; i++) {
|
|
12
|
+
for (let j = i + 1; j < laid.length; j++) {
|
|
13
|
+
const a = laid[i];
|
|
14
|
+
const b = laid[j];
|
|
15
|
+
if (!plotsOverlap(a.plot, b.plot))
|
|
16
|
+
continue;
|
|
17
|
+
add({
|
|
18
|
+
severity: "error",
|
|
19
|
+
code: "plot-overlap",
|
|
20
|
+
where: `defineNode("${b.kind}").plot`,
|
|
21
|
+
message: `"${a.kind}" at (${a.plot.col}, ${a.plot.row}) and "${b.kind}" at (${b.plot.col}, ${b.plot.row}) stand on the same block.`,
|
|
22
|
+
fix: `Move one of them at least ${BLOCK} cells away, or drop the plot and let the map place it.`,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function checkFigures(ctx) {
|
|
28
|
+
const { app, add } = ctx;
|
|
29
|
+
/*
|
|
30
|
+
* A FIGURE THAT CANNOT BE DRAWN IS A BLANK NOBODY EXPLAINS.
|
|
31
|
+
*
|
|
32
|
+
* Every fault here looks fine in the file and fails on a screen: art with
|
|
33
|
+
* no `viewBox` cannot be sized by anything that draws it, a literal
|
|
34
|
+
* colour ignores the scheme and the kind's hue — and is therefore
|
|
35
|
+
* invisible in one of the two, which nobody notices until somebody
|
|
36
|
+
* switches — and a name that is not in the shipped set is a silent gap
|
|
37
|
+
* where a drawing should be.
|
|
38
|
+
*/
|
|
39
|
+
for (const definition of app.schema.definitions) {
|
|
40
|
+
for (const [where, figure] of [
|
|
41
|
+
[`defineNode("${definition.kind}").figure`, definition.figure],
|
|
42
|
+
[`brand.figures["${definition.kind}"]`, app.brand?.figures?.[definition.kind]],
|
|
43
|
+
]) {
|
|
44
|
+
if (!figure)
|
|
45
|
+
continue;
|
|
46
|
+
for (const fault of figureFaults(figure)) {
|
|
47
|
+
add({
|
|
48
|
+
severity: "error",
|
|
49
|
+
code: "figure-undrawable",
|
|
50
|
+
where,
|
|
51
|
+
message: `The figure for "${definition.kind}" cannot be drawn: ${fault}`,
|
|
52
|
+
fix: `Give it one viewBox and currentColor strokes with no fill, or name one of: ${FIGURE_NAMES.join(", ")}.`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
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AAS,CAAC,CAAC,IAAK,CAAC,GAAG,KAAK,CAAC,CAAC,IAAK,CAAC,GAAG,4BAA4B;gBACvI,GAAG,EAAE,6BAA6B,KAAK,yDAAyD;aACjG,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAsB,GAAoB;IACpE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IACzB;;;;;;;;;OASG;IACH,KAAK,MAAM,UAAU,IAAI,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAChD,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI;YAC5B,CAAC,eAAe,UAAU,CAAC,IAAI,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC;YAC9D,CAAC,kBAAkB,UAAU,CAAC,IAAI,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SACtE,EAAE,CAAC;YACX,IAAI,CAAC,MAAM;gBAAE,SAAS;YACtB,KAAK,MAAM,KAAK,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC;oBACF,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,mBAAmB;oBACzB,KAAK;oBACL,OAAO,EAAE,mBAAmB,UAAU,CAAC,IAAI,sBAAsB,KAAK,EAAE;oBACxE,GAAG,EAAE,8EAA8E,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;iBAC9G,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { GraviewApp } from "../../app.js";
|
|
2
|
+
import type { AnySchema } from "../../schema/schema.js";
|
|
3
|
+
/**
|
|
4
|
+
* `note` is a QUESTION ASKED OUT LOUD, not a problem.
|
|
5
|
+
*
|
|
6
|
+
* Some things a checker can see are legitimate designs that the author
|
|
7
|
+
* should nonetheless have looked at once: a lens written for this app and
|
|
8
|
+
* never proved against another domain, a role name two vocabularies both
|
|
9
|
+
* use, a kind unreachable on an empty graph. Filed as warnings they would
|
|
10
|
+
* be warnings that can only ever be acknowledged, and those are the ones
|
|
11
|
+
* people learn to scroll past — which costs the checker its authority on
|
|
12
|
+
* the warnings that matter. So they have their own voice: counted, printed,
|
|
13
|
+
* and never a failure.
|
|
14
|
+
*/
|
|
15
|
+
import type { Finding } from "../check.js";
|
|
16
|
+
import type { AnyMutationDefinition } from "../../mutations/types.js";
|
|
17
|
+
/**
|
|
18
|
+
* WHAT EVERY CHECK IS HANDED: the app, what it declares by name, and the
|
|
19
|
+
* one way a finding is said. The checks are families of questions a
|
|
20
|
+
* declaration is asked — its routes, its lenses, its way in, its city, its
|
|
21
|
+
* intelligence, its settings, its migrations, its brand, its modules, its
|
|
22
|
+
* relations, its fields, its policy — each a file of its own, asked in the
|
|
23
|
+
* order `checkApp` asks them, so a report reads the same as it always has.
|
|
24
|
+
*/
|
|
25
|
+
export interface CheckContext<S extends AnySchema> {
|
|
26
|
+
readonly app: GraviewApp<S>;
|
|
27
|
+
readonly kinds: ReadonlySet<string>;
|
|
28
|
+
readonly declaredMutations: readonly AnyMutationDefinition<S>[];
|
|
29
|
+
readonly derivedEdits: readonly AnyMutationDefinition<S>[];
|
|
30
|
+
readonly derivedRemoves: readonly AnyMutationDefinition<S>[];
|
|
31
|
+
readonly mutations: ReadonlyMap<string, AnyMutationDefinition<S>>;
|
|
32
|
+
readonly invariants: ReadonlyMap<string, NonNullable<GraviewApp<S>["invariants"]>[number]>;
|
|
33
|
+
add(finding: Finding): void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Whether a string schema has been given a ceiling.
|
|
37
|
+
*
|
|
38
|
+
* Asked by parsing one string past any name: a schema that refuses it for
|
|
39
|
+
* any reason — a max, a regex, an enum — is bounded in the way that matters
|
|
40
|
+
* here, and asking is the only way to find that out without knowing what
|
|
41
|
+
* every check means.
|
|
42
|
+
*/
|
|
43
|
+
export declare function bounded(field: unknown): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The field a role is bound to, whichever of the two shapes was written: a
|
|
46
|
+
* bare field name, or `{ field, is }` — a field and the values that make the
|
|
47
|
+
* role true, the same shape `lifecycle` takes. Undefined when it is neither.
|
|
48
|
+
*/
|
|
49
|
+
export declare function fieldOf(bound: unknown): string | undefined;
|
|
50
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/cli/check/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,SAAS;IAC/C,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,QAAQ,CAAC,YAAY,EAAE,SAAS,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3D,QAAQ,CAAC,cAAc,EAAE,SAAS,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3F,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAU/C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQ1D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a string schema has been given a ceiling.
|
|
3
|
+
*
|
|
4
|
+
* Asked by parsing one string past any name: a schema that refuses it for
|
|
5
|
+
* any reason — a max, a regex, an enum — is bounded in the way that matters
|
|
6
|
+
* here, and asking is the only way to find that out without knowing what
|
|
7
|
+
* every check means.
|
|
8
|
+
*/
|
|
9
|
+
export function bounded(field) {
|
|
10
|
+
const schema = field;
|
|
11
|
+
if (typeof schema?.safeParse !== "function")
|
|
12
|
+
return true;
|
|
13
|
+
/*
|
|
14
|
+
* WHETHER A CEILING WAS CHOSEN, not whether it is sixty. The note asks
|
|
15
|
+
* that the call was made; a catalogue's real titles run to 78 characters
|
|
16
|
+
* and a bound of 100 is a call. Ten thousand characters is past any
|
|
17
|
+
* ceiling somebody chose for a name.
|
|
18
|
+
*/
|
|
19
|
+
return !schema.safeParse("x".repeat(10_000)).success;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The field a role is bound to, whichever of the two shapes was written: a
|
|
23
|
+
* bare field name, or `{ field, is }` — a field and the values that make the
|
|
24
|
+
* role true, the same shape `lifecycle` takes. Undefined when it is neither.
|
|
25
|
+
*/
|
|
26
|
+
export function fieldOf(bound) {
|
|
27
|
+
if (typeof bound === "string")
|
|
28
|
+
return bound;
|
|
29
|
+
if (bound !== null && typeof bound === "object") {
|
|
30
|
+
const field = bound.field;
|
|
31
|
+
const is = bound.is;
|
|
32
|
+
if (typeof field === "string" && Array.isArray(is) && is.length > 0)
|
|
33
|
+
return field;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/cli/check/context.ts"],"names":[],"mappings":"AAqCA;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,MAAM,MAAM,GAAG,KAAiE,CAAC;IACjF,IAAI,OAAO,MAAM,EAAE,SAAS,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IACzD;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,KAAK,GAAI,KAA6B,CAAC,KAAK,CAAC;QACnD,MAAM,EAAE,GAAI,KAA0B,CAAC,EAAE,CAAC;QAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;IACpF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnySchema } from "../../schema/schema.js";
|
|
2
|
+
/**
|
|
3
|
+
* `note` is a QUESTION ASKED OUT LOUD, not a problem.
|
|
4
|
+
*
|
|
5
|
+
* Some things a checker can see are legitimate designs that the author
|
|
6
|
+
* should nonetheless have looked at once: a lens written for this app and
|
|
7
|
+
* never proved against another domain, a role name two vocabularies both
|
|
8
|
+
* use, a kind unreachable on an empty graph. Filed as warnings they would
|
|
9
|
+
* be warnings that can only ever be acknowledged, and those are the ones
|
|
10
|
+
* people learn to scroll past — which costs the checker its authority on
|
|
11
|
+
* the warnings that matter. So they have their own voice: counted, printed,
|
|
12
|
+
* and never a failure.
|
|
13
|
+
*/
|
|
14
|
+
import type { CheckContext } from "./context.js";
|
|
15
|
+
export declare function checkEditableFields<S extends AnySchema>(ctx: CheckContext<S>): void;
|
|
16
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../../src/cli/check/fields.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CA4OnF"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { editVia, fieldWriters, subjectKindsOf, unwrittenFields } from "../../mutations/derive-edits.js";
|
|
2
|
+
import { nodeRefArgs } from "../../mutations/node-ref.js";
|
|
3
|
+
import { withArticle } from "../../schema/define-node.js";
|
|
4
|
+
import { permits, rolesOf } from "../../permissions/policy.js";
|
|
5
|
+
export function checkEditableFields(ctx) {
|
|
6
|
+
const { app, kinds, declaredMutations, add } = ctx;
|
|
7
|
+
/*
|
|
8
|
+
* A FIELD YOU COULD SET AT CREATION, YOU CAN CHANGE — and when you cannot,
|
|
9
|
+
* the declaration says why.
|
|
10
|
+
*
|
|
11
|
+
* Every settable field nobody writes is covered by the derived edit act,
|
|
12
|
+
* so a field is out of reach only when that act is: under a policy that
|
|
13
|
+
* lets no role write or create the kind, or where an app declared its own
|
|
14
|
+
* `edit-<kind>` that leaves the field alone. `fixed` is the way to say a
|
|
15
|
+
* field never changes on purpose; naming a field nothing declares, or one
|
|
16
|
+
* some act writes anyway, is a contradiction worth hearing about.
|
|
17
|
+
*/
|
|
18
|
+
{
|
|
19
|
+
const writers = fieldWriters(app.schema, declaredMutations);
|
|
20
|
+
const roles = app.policy ? rolesOf(app.policy) : [];
|
|
21
|
+
for (const definition of app.schema.definitions) {
|
|
22
|
+
const shape = definition.fields.shape;
|
|
23
|
+
for (const [field, why] of Object.entries(definition.fixed ?? {})) {
|
|
24
|
+
if (!(field in shape)) {
|
|
25
|
+
add({
|
|
26
|
+
severity: "error",
|
|
27
|
+
code: "fixed-unknown-field",
|
|
28
|
+
where: `defineNode("${definition.kind}").fixed`,
|
|
29
|
+
message: `Marks "${field}" fixed, which is not in this kind's fields.`,
|
|
30
|
+
fix: `Point it at one of: ${Object.keys(shape).join(", ")}.`,
|
|
31
|
+
});
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const written = writers.get(definition.kind)?.get(field) ?? [];
|
|
35
|
+
if (written.length > 0) {
|
|
36
|
+
add({
|
|
37
|
+
severity: "warning",
|
|
38
|
+
code: "fixed-but-written",
|
|
39
|
+
where: `defineNode("${definition.kind}").fixed.${field}`,
|
|
40
|
+
message: `"${field}" is marked fixed ("${why}") yet ${written.join(", ")} writes it.`,
|
|
41
|
+
fix: `Drop it from fixed, or stop ${written.join(" / ")} writing it.`,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const uncovered = unwrittenFields(app.schema, declaredMutations, definition.kind);
|
|
46
|
+
if (uncovered.length === 0)
|
|
47
|
+
continue;
|
|
48
|
+
const derivedName = `edit-${definition.kind}`;
|
|
49
|
+
const own = declaredMutations.find((mutation) => mutation.name === derivedName);
|
|
50
|
+
let reason = null;
|
|
51
|
+
if (own) {
|
|
52
|
+
// The app kept the name; the derivation stood aside.
|
|
53
|
+
const ownWrites = writers.get(definition.kind) ?? new Map();
|
|
54
|
+
if (uncovered.some((field) => !ownWrites.has(field))) {
|
|
55
|
+
reason = `"${derivedName}" is declared by the app, so no edit act was derived, and it does not write them`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else if (app.policy) {
|
|
59
|
+
const via = editVia(app.schema, declaredMutations, definition.kind);
|
|
60
|
+
const reachable = via.length > 0 &&
|
|
61
|
+
(roles.some((role) => permits(app.policy, { kind: "human", roles: [role] }, derivedName, definition.kind, via).ok) ||
|
|
62
|
+
permits(app.policy, { kind: "human", roles: [] }, derivedName, definition.kind, via).ok);
|
|
63
|
+
if (!reachable) {
|
|
64
|
+
reason =
|
|
65
|
+
via.length === 0
|
|
66
|
+
? `no declared act writes or creates ${withArticle(definition.kind)}, so the derived edit is nobody's`
|
|
67
|
+
: `no role may run any act that writes or creates ${withArticle(definition.kind)} (${via.join(", ")}), so the derived edit is out of everyone's reach`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (reason === null)
|
|
71
|
+
continue;
|
|
72
|
+
for (const field of uncovered) {
|
|
73
|
+
add({
|
|
74
|
+
severity: "warning",
|
|
75
|
+
code: "field-without-writer",
|
|
76
|
+
where: `defineNode("${definition.kind}").fields.${field}`,
|
|
77
|
+
message: `"${field}" is set when ${withArticle(definition.kind)} is made and nothing can ever change it — ${reason}.`,
|
|
78
|
+
fix: `Declare writes: ["${field}"] on the act that changes it (and grant that act), ` +
|
|
79
|
+
`or mark it fixed: { ${field}: "why it never changes" } on defineNode("${definition.kind}").`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const titles = new Map();
|
|
85
|
+
for (const mutation of app.mutations ?? []) {
|
|
86
|
+
/*
|
|
87
|
+
* A TITLE is the whole label a person gets, and a DESCRIPTION is the whole
|
|
88
|
+
* instruction an agent gets. Neither is a slug.
|
|
89
|
+
*
|
|
90
|
+
* `mutationToolSchema` falls back from description to title to name, so a
|
|
91
|
+
* mutation that says nothing hands an agent a label where an instruction
|
|
92
|
+
* belongs — and the same opaque string is what a person reads in the
|
|
93
|
+
* actions strip. An unreadable one costs twice, which is why this is
|
|
94
|
+
* checked at build time rather than noticed in use.
|
|
95
|
+
*/
|
|
96
|
+
for (const [field, listed] of [
|
|
97
|
+
["connects", mutation.connects ?? []],
|
|
98
|
+
["severs", mutation.severs ?? []],
|
|
99
|
+
]) {
|
|
100
|
+
for (const edgeKind of listed) {
|
|
101
|
+
if (!app.schema.edgeKinds.includes(edgeKind)) {
|
|
102
|
+
add({
|
|
103
|
+
severity: "error",
|
|
104
|
+
code: "edge-claim-unknown-kind",
|
|
105
|
+
where: `defineMutation("${mutation.name}").${field}`,
|
|
106
|
+
message: `Claims to ${field === "connects" ? "make" : "break"} "${edgeKind}" edges, which no declaration mentions.`,
|
|
107
|
+
fix: `Use one of: ${app.schema.edgeKinds.join(", ")}.`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/*
|
|
113
|
+
* A mutation that SAYS what it writes is believed about it — so what it
|
|
114
|
+
* says has to exist. A field name no subject kind declares is a typo the
|
|
115
|
+
* in-place edit would silently offer nothing for.
|
|
116
|
+
*/
|
|
117
|
+
for (const field of mutation.writes ?? []) {
|
|
118
|
+
const subjectKinds = subjectKindsOf(app.schema, mutation);
|
|
119
|
+
const onSome = subjectKinds.some((kind) => {
|
|
120
|
+
const shape = app.schema.tryDefinition(kind)?.fields.shape;
|
|
121
|
+
return shape !== undefined && field in shape;
|
|
122
|
+
});
|
|
123
|
+
if (onSome)
|
|
124
|
+
continue;
|
|
125
|
+
add({
|
|
126
|
+
severity: "error",
|
|
127
|
+
code: "writes-unknown-field",
|
|
128
|
+
where: `defineMutation("${mutation.name}").writes`,
|
|
129
|
+
message: subjectKinds.length === 0
|
|
130
|
+
? `Claims to write "${field}", but declares no subject to write it on.`
|
|
131
|
+
: `Claims to write "${field}", which none of its subject kinds (${subjectKinds.join(", ")}) declares.`,
|
|
132
|
+
fix: subjectKinds.length === 0
|
|
133
|
+
? "Declare a subject, or drop writes."
|
|
134
|
+
: `Use a field of ${subjectKinds.join(" / ")}, or drop it from writes.`,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
for (const created of mutation.creates ?? []) {
|
|
138
|
+
if (!kinds.has(created)) {
|
|
139
|
+
add({
|
|
140
|
+
severity: "error",
|
|
141
|
+
code: "creates-unknown-kind",
|
|
142
|
+
where: `defineMutation("${mutation.name}").creates`,
|
|
143
|
+
message: `Claims to create "${String(created)}", which no defineNode declares.`,
|
|
144
|
+
fix: `Declare the kind, or correct the creates list.`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!mutation.title || mutation.title.trim().length === 0) {
|
|
149
|
+
add({
|
|
150
|
+
severity: "error",
|
|
151
|
+
code: "mutation-untitled",
|
|
152
|
+
where: `defineMutation("${mutation.name}").title`,
|
|
153
|
+
message: "No title, so the interface will show the mutation's slug as its label.",
|
|
154
|
+
fix: `Add title: "<what this does, in the app's own words>".`,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
const said = titles.get(mutation.title);
|
|
159
|
+
if (said) {
|
|
160
|
+
add({
|
|
161
|
+
severity: "warning",
|
|
162
|
+
code: "mutation-title-ambiguous",
|
|
163
|
+
where: `defineMutation("${mutation.name}").title`,
|
|
164
|
+
message: `"${mutation.title}" is also the title of "${said}", so the two are indistinguishable wherever both are offered.`,
|
|
165
|
+
fix: "Give one of them a title that says which it is.",
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
titles.set(mutation.title, mutation.name);
|
|
169
|
+
/*
|
|
170
|
+
* A title that is an IDENTIFIER names the code rather than the act.
|
|
171
|
+
*
|
|
172
|
+
* Deliberately narrow: "Add person" matches its slug and is a perfectly
|
|
173
|
+
* good label, so slug-similarity is not the signal. An underscore is,
|
|
174
|
+
* and so is a hyphen or interior capitals in a title that is one word.
|
|
175
|
+
* A hyphen inside a sentence is English: "Offer a trade-in", "Book a
|
|
176
|
+
* follow-up", "Re-open it" are labels on buttons.
|
|
177
|
+
*/
|
|
178
|
+
const oneWord = !/\s/.test(mutation.title.trim());
|
|
179
|
+
if (/_/.test(mutation.title) || (oneWord && /-/.test(mutation.title)) || /^[a-z]+[A-Z]/.test(mutation.title)) {
|
|
180
|
+
add({
|
|
181
|
+
severity: "warning",
|
|
182
|
+
code: "mutation-title-is-an-identifier",
|
|
183
|
+
where: `defineMutation("${mutation.name}").title`,
|
|
184
|
+
message: `"${mutation.title}" reads as a name in the source rather than as a label on a button.`,
|
|
185
|
+
fix: "Say what it does to the thing it is offered on, in the app's own words.",
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (!mutation.description || mutation.description.trim().length === 0) {
|
|
190
|
+
add({
|
|
191
|
+
severity: "warning",
|
|
192
|
+
code: "mutation-undescribed",
|
|
193
|
+
where: `defineMutation("${mutation.name}").description`,
|
|
194
|
+
message: "No description, so an agent's tool schema falls back to the title — a label where an instruction belongs.",
|
|
195
|
+
fix: "Add a sentence saying what it is for and when to reach for it.",
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const subject = mutation.subject;
|
|
199
|
+
if (subject && subject.kinds !== "*") {
|
|
200
|
+
for (const kind of subject.kinds) {
|
|
201
|
+
if (!kinds.has(kind)) {
|
|
202
|
+
add({
|
|
203
|
+
severity: "error",
|
|
204
|
+
code: "mutation-subject-undeclared",
|
|
205
|
+
where: `defineMutation("${mutation.name}").subject.kinds`,
|
|
206
|
+
message: `Subject kind "${String(kind)}" is not declared.`,
|
|
207
|
+
fix: `Use one of: ${[...kinds].join(", ")}.`,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const shape = mutation.input.shape;
|
|
212
|
+
if (shape && !(subject.arg in shape)) {
|
|
213
|
+
add({
|
|
214
|
+
severity: "error",
|
|
215
|
+
code: "mutation-subject-arg-missing",
|
|
216
|
+
where: `defineMutation("${mutation.name}").subject.arg`,
|
|
217
|
+
message: `Subject binds to argument "${subject.arg}", which is not in the input schema.`,
|
|
218
|
+
fix: `Add "${subject.arg}" to the input, or point subject.arg at one of: ${Object.keys(shape).join(", ")}.`,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
for (const ref of nodeRefArgs(mutation.input)) {
|
|
223
|
+
for (const kind of ref.kinds) {
|
|
224
|
+
if (kind !== "*" && !kinds.has(kind)) {
|
|
225
|
+
add({
|
|
226
|
+
severity: "error",
|
|
227
|
+
code: "node-ref-undeclared",
|
|
228
|
+
where: `defineMutation("${mutation.name}").input.${ref.name}`,
|
|
229
|
+
message: `nodeRef accepts "${kind}", which no defineNode declares.`,
|
|
230
|
+
fix: `Use one of: ${[...kinds].join(", ")}.`,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../src/cli/check/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAiB/D,MAAM,UAAU,mBAAmB,CAAsB,GAAoB;IAC3E,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IACnD;;;;;;;;;;OAUG;IACH,CAAC;QACC,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,C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,EAAE,CAAC;oBACrC,GAAG,CAAC;wBACF,QAAQ,EAAE,OAAO;wBACjB,IAAI,EAAE,qBAAqB;wBAC3B,KAAK,EAAE,mBAAmB,QAAQ,CAAC,IAAI,YAAY,GAAG,CAAC,IAAI,EAAE;wBAC7D,OAAO,EAAE,oBAAoB,IAAI,kCAAkC;wBACnE,GAAG,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;qBAC7C,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./routes.js";
|
|
2
|
+
export * from "./lenses.js";
|
|
3
|
+
export * from "./beginnings.js";
|
|
4
|
+
export * from "./intelligence.js";
|
|
5
|
+
export * from "./city.js";
|
|
6
|
+
export * from "./settings.js";
|
|
7
|
+
export * from "./migrations.js";
|
|
8
|
+
export * from "./brand.js";
|
|
9
|
+
export * from "./modules.js";
|
|
10
|
+
export * from "./relations.js";
|
|
11
|
+
export * from "./fields.js";
|
|
12
|
+
export * from "./policy.js";
|
|
13
|
+
export * from "./arrangement.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|