@jam-overture/loom 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 +21 -0
- package/README.md +743 -0
- package/dist/catalogue.d.ts +70 -0
- package/dist/catalogue.js +88 -0
- package/dist/cli/args.d.ts +17 -0
- package/dist/cli/args.js +83 -0
- package/dist/cli/filesystem.d.ts +15 -0
- package/dist/cli/filesystem.js +31 -0
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +30 -0
- package/dist/cli/namespace.d.ts +40 -0
- package/dist/cli/namespace.js +40 -0
- package/dist/cli/plan.d.ts +84 -0
- package/dist/cli/plan.js +113 -0
- package/dist/cli/run.d.ts +17 -0
- package/dist/cli/run.js +75 -0
- package/dist/cli/templates.d.ts +43 -0
- package/dist/cli/templates.js +134 -0
- package/dist/closed-set.d.ts +34 -0
- package/dist/closed-set.js +34 -0
- package/dist/data/adapter.d.ts +123 -0
- package/dist/data/adapter.js +91 -0
- package/dist/data/binding.d.ts +48 -0
- package/dist/data/binding.js +39 -0
- package/dist/data/catalogue.d.ts +26 -0
- package/dist/data/catalogue.js +6 -0
- package/dist/data/index.d.ts +14 -0
- package/dist/data/index.js +14 -0
- package/dist/data/plan.d.ts +58 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +91 -0
- package/dist/data/resolution.js +96 -0
- package/dist/data/resolve.d.ts +46 -0
- package/dist/data/resolve.js +37 -0
- package/dist/data/source.d.ts +40 -0
- package/dist/data/source.js +45 -0
- package/dist/deadline.d.ts +57 -0
- package/dist/deadline.js +78 -0
- package/dist/frame/catalogue.d.ts +24 -0
- package/dist/frame/catalogue.js +5 -0
- package/dist/frame/index.d.ts +12 -0
- package/dist/frame/index.js +12 -0
- package/dist/frame/origin.d.ts +87 -0
- package/dist/frame/origin.js +114 -0
- package/dist/frame/resolution.d.ts +85 -0
- package/dist/frame/resolution.js +79 -0
- package/dist/grammar.d.ts +26 -0
- package/dist/grammar.js +28 -0
- package/dist/ids.d.ts +57 -0
- package/dist/ids.js +104 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/interactivity.d.ts +50 -0
- package/dist/interactivity.js +22 -0
- package/dist/interpretation/anthropic.d.ts +22 -0
- package/dist/interpretation/anthropic.js +76 -0
- package/dist/interpretation/client.d.ts +83 -0
- package/dist/interpretation/client.js +2 -0
- package/dist/interpretation/draft.d.ts +234 -0
- package/dist/interpretation/draft.js +84 -0
- package/dist/interpretation/index.d.ts +15 -0
- package/dist/interpretation/index.js +15 -0
- package/dist/interpretation/interpreter.d.ts +62 -0
- package/dist/interpretation/interpreter.js +151 -0
- package/dist/interpretation/materialize.d.ts +42 -0
- package/dist/interpretation/materialize.js +107 -0
- package/dist/interpretation/prompt.d.ts +229 -0
- package/dist/interpretation/prompt.js +285 -0
- package/dist/interpretation/render.d.ts +76 -0
- package/dist/interpretation/render.js +272 -0
- package/dist/interpretation/schema.d.ts +49 -0
- package/dist/interpretation/schema.js +131 -0
- package/dist/json.d.ts +35 -0
- package/dist/json.js +11 -0
- package/dist/paging.d.ts +60 -0
- package/dist/paging.js +49 -0
- package/dist/primitive-type.d.ts +32 -0
- package/dist/primitive-type.js +39 -0
- package/dist/render/addressing.d.ts +59 -0
- package/dist/render/addressing.js +60 -0
- package/dist/render/anchor.d.ts +105 -0
- package/dist/render/anchor.js +84 -0
- package/dist/render/behaviour-adjust.d.ts +62 -0
- package/dist/render/behaviour-adjust.js +78 -0
- package/dist/render/behaviour-copy.d.ts +53 -0
- package/dist/render/behaviour-copy.js +75 -0
- package/dist/render/behaviour-disclose.d.ts +74 -0
- package/dist/render/behaviour-disclose.js +77 -0
- package/dist/render/behaviour-present.d.ts +123 -0
- package/dist/render/behaviour-present.js +173 -0
- package/dist/render/behaviour.d.ts +243 -0
- package/dist/render/behaviour.js +284 -0
- package/dist/render/control.d.ts +81 -0
- package/dist/render/control.js +80 -0
- package/dist/render/decorative.d.ts +62 -0
- package/dist/render/decorative.js +2 -0
- package/dist/render/diagnostics.d.ts +260 -0
- package/dist/render/diagnostics.js +61 -0
- package/dist/render/disclosed.d.ts +37 -0
- package/dist/render/disclosed.js +37 -0
- package/dist/render/editable.d.ts +34 -0
- package/dist/render/editable.js +35 -0
- package/dist/render/frame.d.ts +42 -0
- package/dist/render/frame.js +31 -0
- package/dist/render/index.d.ts +35 -0
- package/dist/render/index.js +35 -0
- package/dist/render/inline-variables.d.ts +77 -0
- package/dist/render/inline-variables.js +220 -0
- package/dist/render/presented.d.ts +82 -0
- package/dist/render/presented.js +82 -0
- package/dist/render/primitive.d.ts +228 -0
- package/dist/render/primitive.js +36 -0
- package/dist/render/props.d.ts +48 -0
- package/dist/render/props.js +2 -0
- package/dist/render/reads.d.ts +73 -0
- package/dist/render/reads.js +45 -0
- package/dist/render/render.d.ts +164 -0
- package/dist/render/render.js +571 -0
- package/dist/render/request.d.ts +111 -0
- package/dist/render/request.js +60 -0
- package/dist/render/text.d.ts +91 -0
- package/dist/render/text.js +44 -0
- package/dist/render/theme.d.ts +61 -0
- package/dist/render/theme.js +52 -0
- package/dist/reserved-props.d.ts +35 -0
- package/dist/reserved-props.js +45 -0
- package/dist/result.d.ts +27 -0
- package/dist/result.js +30 -0
- package/dist/role.d.ts +71 -0
- package/dist/role.js +22 -0
- package/dist/runtime/analysis.d.ts +149 -0
- package/dist/runtime/analysis.js +187 -0
- package/dist/runtime/assessment.d.ts +35 -0
- package/dist/runtime/assessment.js +13 -0
- package/dist/runtime/disposition.d.ts +102 -0
- package/dist/runtime/disposition.js +59 -0
- package/dist/runtime/events.d.ts +187 -0
- package/dist/runtime/events.js +7 -0
- package/dist/runtime/gate.d.ts +43 -0
- package/dist/runtime/gate.js +169 -0
- package/dist/runtime/index.d.ts +27 -0
- package/dist/runtime/index.js +27 -0
- package/dist/runtime/intent.d.ts +60 -0
- package/dist/runtime/intent.js +36 -0
- package/dist/runtime/interpreter.d.ts +117 -0
- package/dist/runtime/interpreter.js +46 -0
- package/dist/runtime/inverse-interpreter.d.ts +90 -0
- package/dist/runtime/inverse-interpreter.js +56 -0
- package/dist/runtime/inverse.d.ts +87 -0
- package/dist/runtime/inverse.js +48 -0
- package/dist/runtime/narration.d.ts +24 -0
- package/dist/runtime/narration.js +36 -0
- package/dist/runtime/nesting.d.ts +31 -0
- package/dist/runtime/nesting.js +46 -0
- package/dist/runtime/pipeline.d.ts +124 -0
- package/dist/runtime/pipeline.js +178 -0
- package/dist/runtime/policy-fingerprint.d.ts +29 -0
- package/dist/runtime/policy-fingerprint.js +119 -0
- package/dist/runtime/policy-source.d.ts +42 -0
- package/dist/runtime/policy-source.js +8 -0
- package/dist/runtime/policy.d.ts +156 -0
- package/dist/runtime/policy.js +107 -0
- package/dist/runtime/proposal.d.ts +423 -0
- package/dist/runtime/proposal.js +109 -0
- package/dist/runtime/redirection.d.ts +53 -0
- package/dist/runtime/redirection.js +38 -0
- package/dist/runtime/repointing.d.ts +71 -0
- package/dist/runtime/repointing.js +0 -0
- package/dist/runtime/reversibility.d.ts +36 -0
- package/dist/runtime/reversibility.js +39 -0
- package/dist/runtime/stake-level.d.ts +33 -0
- package/dist/runtime/stake-level.js +58 -0
- package/dist/runtime/stakes.d.ts +47 -0
- package/dist/runtime/stakes.js +305 -0
- package/dist/runtime/vocabulary.d.ts +122 -0
- package/dist/runtime/vocabulary.js +87 -0
- package/dist/sdk/audit.d.ts +195 -0
- package/dist/sdk/audit.js +128 -0
- package/dist/sdk/catalogue.d.ts +37 -0
- package/dist/sdk/catalogue.js +16 -0
- package/dist/sdk/conformance.d.ts +342 -0
- package/dist/sdk/conformance.js +494 -0
- package/dist/sdk/copy.d.ts +105 -0
- package/dist/sdk/copy.js +90 -0
- package/dist/sdk/definition.d.ts +242 -0
- package/dist/sdk/definition.js +64 -0
- package/dist/sdk/index.d.ts +19 -0
- package/dist/sdk/index.js +19 -0
- package/dist/sdk/interactivity.d.ts +29 -0
- package/dist/sdk/interactivity.js +34 -0
- package/dist/sdk/pairings.d.ts +124 -0
- package/dist/sdk/pairings.js +81 -0
- package/dist/sdk/registry.d.ts +162 -0
- package/dist/sdk/registry.js +329 -0
- package/dist/sdk/selection.d.ts +46 -0
- package/dist/sdk/selection.js +24 -0
- package/dist/sdk/text.d.ts +100 -0
- package/dist/sdk/text.js +105 -0
- package/dist/sdk/vocabulary.d.ts +39 -0
- package/dist/sdk/vocabulary.js +36 -0
- package/dist/signals/broadcast.d.ts +134 -0
- package/dist/signals/broadcast.js +451 -0
- package/dist/signals/collect.d.ts +184 -0
- package/dist/signals/collect.js +196 -0
- package/dist/signals/deliver.d.ts +64 -0
- package/dist/signals/deliver.js +85 -0
- package/dist/signals/fold.d.ts +112 -0
- package/dist/signals/fold.js +76 -0
- package/dist/signals/index.d.ts +31 -0
- package/dist/signals/index.js +31 -0
- package/dist/signals/ingest.d.ts +51 -0
- package/dist/signals/ingest.js +70 -0
- package/dist/signals/intake.d.ts +149 -0
- package/dist/signals/intake.js +154 -0
- package/dist/signals/journal.d.ts +94 -0
- package/dist/signals/journal.js +11 -0
- package/dist/signals/kinds.d.ts +22 -0
- package/dist/signals/kinds.js +22 -0
- package/dist/signals/ledger.d.ts +46 -0
- package/dist/signals/ledger.js +81 -0
- package/dist/signals/memory.d.ts +17 -0
- package/dist/signals/memory.js +99 -0
- package/dist/signals/migrate.d.ts +27 -0
- package/dist/signals/migrate.js +78 -0
- package/dist/signals/postgres.d.ts +7 -0
- package/dist/signals/postgres.js +295 -0
- package/dist/signals/rollup.d.ts +142 -0
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +534 -0
- package/dist/signals/schema.js +92 -0
- package/dist/signals/signal.d.ts +381 -0
- package/dist/signals/signal.js +150 -0
- package/dist/signals/tally.d.ts +70 -0
- package/dist/signals/tally.js +2 -0
- package/dist/signals/view.d.ts +51 -0
- package/dist/signals/view.js +54 -0
- package/dist/store/attribution.d.ts +125 -0
- package/dist/store/attribution.js +116 -0
- package/dist/store/database.d.ts +14 -0
- package/dist/store/database.js +2 -0
- package/dist/store/driver.d.ts +29 -0
- package/dist/store/driver.js +39 -0
- package/dist/store/errors.d.ts +56 -0
- package/dist/store/errors.js +37 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.js +16 -0
- package/dist/store/memory.d.ts +3 -0
- package/dist/store/memory.js +115 -0
- package/dist/store/migrate.d.ts +54 -0
- package/dist/store/migrate.js +122 -0
- package/dist/store/postgres-holds.d.ts +4 -0
- package/dist/store/postgres-holds.js +192 -0
- package/dist/store/postgres.d.ts +8 -0
- package/dist/store/postgres.js +262 -0
- package/dist/store/replay.d.ts +94 -0
- package/dist/store/replay.js +82 -0
- package/dist/store/revert.d.ts +116 -0
- package/dist/store/revert.js +243 -0
- package/dist/store/schema.d.ts +371 -0
- package/dist/store/schema.js +78 -0
- package/dist/store/source.d.ts +23 -0
- package/dist/store/source.js +37 -0
- package/dist/store/store.d.ts +231 -0
- package/dist/store/store.js +52 -0
- package/dist/store/undone.d.ts +18 -0
- package/dist/store/undone.js +89 -0
- package/dist/submit/catalogue.d.ts +20 -0
- package/dist/submit/catalogue.js +5 -0
- package/dist/submit/declaration.d.ts +39 -0
- package/dist/submit/declaration.js +30 -0
- package/dist/submit/endpoint.d.ts +131 -0
- package/dist/submit/endpoint.js +160 -0
- package/dist/submit/index.d.ts +13 -0
- package/dist/submit/index.js +13 -0
- package/dist/submit/plan.d.ts +49 -0
- package/dist/submit/plan.js +47 -0
- package/dist/submit/resolution.d.ts +61 -0
- package/dist/submit/resolution.js +64 -0
- package/dist/submit/resolve.d.ts +45 -0
- package/dist/submit/resolve.js +36 -0
- package/dist/telemetry/calibration.d.ts +132 -0
- package/dist/telemetry/calibration.js +151 -0
- package/dist/telemetry/episode.d.ts +140 -0
- package/dist/telemetry/episode.js +272 -0
- package/dist/telemetry/event.d.ts +2310 -0
- package/dist/telemetry/event.js +405 -0
- package/dist/telemetry/index.d.ts +15 -0
- package/dist/telemetry/index.js +15 -0
- package/dist/telemetry/journal.d.ts +116 -0
- package/dist/telemetry/journal.js +11 -0
- package/dist/telemetry/memory.d.ts +24 -0
- package/dist/telemetry/memory.js +75 -0
- package/dist/telemetry/migrate.d.ts +26 -0
- package/dist/telemetry/migrate.js +40 -0
- package/dist/telemetry/postgres.d.ts +6 -0
- package/dist/telemetry/postgres.js +139 -0
- package/dist/telemetry/retention.d.ts +131 -0
- package/dist/telemetry/retention.js +217 -0
- package/dist/telemetry/schema.d.ts +113 -0
- package/dist/telemetry/schema.js +33 -0
- package/dist/telemetry/sink.d.ts +42 -0
- package/dist/telemetry/sink.js +61 -0
- package/dist/testing/contracts.d.ts +34 -0
- package/dist/testing/contracts.js +34 -0
- package/dist/testing/definitions.d.ts +15 -0
- package/dist/testing/definitions.js +48 -0
- package/dist/testing/doubles.d.ts +94 -0
- package/dist/testing/doubles.js +141 -0
- package/dist/testing/episode-harness.d.ts +49 -0
- package/dist/testing/episode-harness.js +65 -0
- package/dist/testing/filesystem.d.ts +17 -0
- package/dist/testing/filesystem.js +17 -0
- package/dist/testing/fixtures.d.ts +57 -0
- package/dist/testing/fixtures.js +84 -0
- package/dist/testing/hold-contract.d.ts +19 -0
- package/dist/testing/hold-contract.js +374 -0
- package/dist/testing/index.d.ts +41 -0
- package/dist/testing/index.js +41 -0
- package/dist/testing/journal-contract.d.ts +17 -0
- package/dist/testing/journal-contract.js +353 -0
- package/dist/testing/model-replies.d.ts +34 -0
- package/dist/testing/model-replies.js +101 -0
- package/dist/testing/primitives.d.ts +7 -0
- package/dist/testing/primitives.js +29 -0
- package/dist/testing/reader-signal-contract.d.ts +38 -0
- package/dist/testing/reader-signal-contract.js +318 -0
- package/dist/testing/row-security.d.ts +17 -0
- package/dist/testing/row-security.js +21 -0
- package/dist/testing/store-contract.d.ts +25 -0
- package/dist/testing/store-contract.js +500 -0
- package/dist/theme/apply.d.ts +17 -0
- package/dist/theme/apply.js +60 -0
- package/dist/theme/contrast.d.ts +197 -0
- package/dist/theme/contrast.js +259 -0
- package/dist/theme/derive.d.ts +77 -0
- package/dist/theme/derive.js +167 -0
- package/dist/theme/faces.d.ts +73 -0
- package/dist/theme/faces.js +119 -0
- package/dist/theme/font-packs.d.ts +25 -0
- package/dist/theme/font-packs.js +257 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/index.js +20 -0
- package/dist/theme/lab.d.ts +30 -0
- package/dist/theme/lab.js +46 -0
- package/dist/theme/library.d.ts +114 -0
- package/dist/theme/library.js +300 -0
- package/dist/theme/measure.d.ts +144 -0
- package/dist/theme/measure.js +145 -0
- package/dist/theme/palettes.d.ts +64 -0
- package/dist/theme/palettes.js +497 -0
- package/dist/theme/registry.d.ts +59 -0
- package/dist/theme/registry.js +60 -0
- package/dist/theme/separation.d.ts +177 -0
- package/dist/theme/separation.js +203 -0
- package/dist/theme/style-presets.d.ts +60 -0
- package/dist/theme/style-presets.js +124 -0
- package/dist/theme/theme.d.ts +253 -0
- package/dist/theme/theme.js +171 -0
- package/dist/tree/apply.d.ts +16 -0
- package/dist/tree/apply.js +104 -0
- package/dist/tree/builders.d.ts +19 -0
- package/dist/tree/builders.js +20 -0
- package/dist/tree/compare.d.ts +68 -0
- package/dist/tree/compare.js +75 -0
- package/dist/tree/configuration.d.ts +25 -0
- package/dist/tree/configuration.js +108 -0
- package/dist/tree/delta.d.ts +288 -0
- package/dist/tree/delta.js +88 -0
- package/dist/tree/errors.d.ts +69 -0
- package/dist/tree/errors.js +34 -0
- package/dist/tree/identity.d.ts +117 -0
- package/dist/tree/identity.js +145 -0
- package/dist/tree/index.d.ts +21 -0
- package/dist/tree/index.js +21 -0
- package/dist/tree/inverse.d.ts +24 -0
- package/dist/tree/inverse.js +112 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +49 -0
- package/dist/tree/naming.d.ts +4 -0
- package/dist/tree/naming.js +35 -0
- package/dist/tree/navigation.d.ts +38 -0
- package/dist/tree/navigation.js +83 -0
- package/dist/tree/node.d.ts +103 -0
- package/dist/tree/node.js +46 -0
- package/dist/tree/outline.d.ts +28 -0
- package/dist/tree/outline.js +10 -0
- package/dist/tree/tree.d.ts +83 -0
- package/dist/tree/tree.js +62 -0
- package/dist/write/commit.d.ts +124 -0
- package/dist/write/commit.js +234 -0
- package/dist/write/held.d.ts +674 -0
- package/dist/write/held.js +185 -0
- package/dist/write/index.d.ts +11 -0
- package/dist/write/index.js +11 -0
- package/dist/write/liveness.d.ts +132 -0
- package/dist/write/liveness.js +91 -0
- package/dist/write/revert.d.ts +79 -0
- package/dist/write/revert.js +134 -0
- package/package.json +160 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { NodeId } from "../ids.js";
|
|
2
|
+
import type { JsonObject } from "../json.js";
|
|
3
|
+
import type { PrimitiveType } from "../primitive-type.js";
|
|
4
|
+
import type { PropsIssue, PropsVerdict } from "../render/props.js";
|
|
5
|
+
import type { LoomNode } from "../tree/node.js";
|
|
6
|
+
/**
|
|
7
|
+
* What a deployment's primitives are, as far as the write path is concerned.
|
|
8
|
+
*
|
|
9
|
+
* The render seam already knows this and says so after the fact: a node whose
|
|
10
|
+
* type nothing resolved comes back as an `unknown-primitive` diagnostic beside
|
|
11
|
+
* a page with a hole in it (0050). Nothing upstream of that had the same
|
|
12
|
+
* knowledge, so a delta naming a type nobody registered was appended to the
|
|
13
|
+
* log, judged on its shape, and found out about at the next render — for every
|
|
14
|
+
* reader, not just the one who asked (0173).
|
|
15
|
+
*
|
|
16
|
+
* The vocabulary is a predicate rather than a list so that a deployment with
|
|
17
|
+
* two registries composes them, and so that this module needs no import from
|
|
18
|
+
* the SDK. `registeredTypesFor(registry)` in the SDK is how a host gets one
|
|
19
|
+
* without hand-keeping it, the same move `interactiveTypesFor` makes.
|
|
20
|
+
*/
|
|
21
|
+
export type PrimitiveVocabulary = (type: PrimitiveType) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* What a host that has declared no vocabulary gets, which is today's behaviour.
|
|
24
|
+
*
|
|
25
|
+
* It answers `true` for everything rather than `false`, and the asymmetry with
|
|
26
|
+
* `NOTHING_INTERACTIVE` is deliberate. Declaring nothing means *I have not told
|
|
27
|
+
* you what I can draw*, which is not the same claim as *I can draw nothing* —
|
|
28
|
+
* and a default that read the second way would refuse every insert on every
|
|
29
|
+
* deployment that has not opted in.
|
|
30
|
+
*/
|
|
31
|
+
export declare const EVERY_TYPE_REGISTERED: PrimitiveVocabulary;
|
|
32
|
+
/**
|
|
33
|
+
* The vocabulary a list of registered types describes.
|
|
34
|
+
*
|
|
35
|
+
* An empty list answers `EVERY_TYPE_REGISTERED` for the reason above: a policy
|
|
36
|
+
* field with an empty default is a host that has not spoken, and a host that
|
|
37
|
+
* has not spoken is not a host claiming an empty library.
|
|
38
|
+
*
|
|
39
|
+
* A `Set` rather than an object index, for the reason `interactivePredicateFor`
|
|
40
|
+
* gives: one lowercase segment is a whole namespaced id, so `constructor` is a
|
|
41
|
+
* legal primitive type, and an ordinary object would report it registered on a
|
|
42
|
+
* deployment that never registered it.
|
|
43
|
+
*/
|
|
44
|
+
export declare const primitiveVocabularyFor: (types: readonly PrimitiveType[]) => PrimitiveVocabulary;
|
|
45
|
+
/** A node a change would add whose type this deployment cannot draw. */
|
|
46
|
+
export type UnknownPrimitive = {
|
|
47
|
+
readonly nodeId: NodeId;
|
|
48
|
+
readonly type: PrimitiveType;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Every element in a subtree whose type the vocabulary does not hold, in
|
|
52
|
+
* document order.
|
|
53
|
+
*
|
|
54
|
+
* The whole subtree rather than its root, because an inserted band carries its
|
|
55
|
+
* own children and a hole three levels down is the same hole.
|
|
56
|
+
*/
|
|
57
|
+
export declare const unknownPrimitivesIn: (node: LoomNode, isRegistered: PrimitiveVocabulary) => readonly UnknownPrimitive[];
|
|
58
|
+
export declare const describeUnknownPrimitive: (unknown: UnknownPrimitive) => string;
|
|
59
|
+
/**
|
|
60
|
+
* What a deployment's primitives accept, as far as the write path is concerned.
|
|
61
|
+
*
|
|
62
|
+
* The type-name vocabulary above answers *can this be drawn at all*. This one
|
|
63
|
+
* answers the question directly beneath it: the type is registered, and does
|
|
64
|
+
* the node carry props the primitive declaring that type will accept? The
|
|
65
|
+
* render seam has always known — a node whose props fail its declared schema is
|
|
66
|
+
* omitted and reported as `invalid-props` (0009) — and nothing upstream shared
|
|
67
|
+
* the knowledge, so a delta carrying two hundred characters against a maximum
|
|
68
|
+
* of a hundred and sixty was appended to the log and found out about at the
|
|
69
|
+
* next render, by every reader rather than by the one who asked (0179).
|
|
70
|
+
*
|
|
71
|
+
* `PropsValidator`'s own verdict, rather than a boolean or a second vocabulary
|
|
72
|
+
* of failure. A predicate would throw away the issues, and a refusal that
|
|
73
|
+
* cannot say *which* prop and *why* is the one a repairer can do nothing with.
|
|
74
|
+
* Reusing the type also means the two seams cannot drift: what the renderer
|
|
75
|
+
* would decline to draw is, by construction, what the write path declines to
|
|
76
|
+
* write.
|
|
77
|
+
*/
|
|
78
|
+
export type PropsVocabulary = (type: PrimitiveType, props: JsonObject) => PropsVerdict;
|
|
79
|
+
/**
|
|
80
|
+
* What a host that has wired no props vocabulary gets, which is today's
|
|
81
|
+
* behaviour.
|
|
82
|
+
*
|
|
83
|
+
* `undeclared` rather than `valid`, and the distinction is not academic: the
|
|
84
|
+
* render seam already separates *these props are fine* from *nobody said what
|
|
85
|
+
* fine is*, and answering the first on a deployment that has declared nothing
|
|
86
|
+
* would be the runtime inventing a claim no schema made.
|
|
87
|
+
*/
|
|
88
|
+
export declare const EVERY_TYPE_UNDECLARED: PropsVocabulary;
|
|
89
|
+
/** A node a change would leave carrying props its own primitive refuses. */
|
|
90
|
+
export type InvalidProps = {
|
|
91
|
+
readonly nodeId: NodeId;
|
|
92
|
+
readonly type: PrimitiveType;
|
|
93
|
+
readonly issues: readonly PropsIssue[];
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Every element in a subtree whose props its declaring primitive refuses, in
|
|
97
|
+
* document order.
|
|
98
|
+
*
|
|
99
|
+
* The whole subtree rather than its root, for the reason `unknownPrimitivesIn`
|
|
100
|
+
* gives: an inserted band carries its own children, and a node three levels
|
|
101
|
+
* down that will not draw is the same hole.
|
|
102
|
+
*
|
|
103
|
+
* Reserved props are not partitioned off first, unlike `renderElement`. A
|
|
104
|
+
* validator is handed what the node carries, and a schema that rejects a
|
|
105
|
+
* reserved key is a schema declaring something about a key the renderer never
|
|
106
|
+
* passes it — which is a fault in the declaration rather than in the change,
|
|
107
|
+
* and not one this seam is positioned to tell apart. `partitionReservedProps`
|
|
108
|
+
* lives behind the render boundary and importing it here would make the write
|
|
109
|
+
* path depend on the renderer's internals to answer a question about a tree.
|
|
110
|
+
*/
|
|
111
|
+
export declare const invalidPropsIn: (node: LoomNode, checkProps: PropsVocabulary) => readonly InvalidProps[];
|
|
112
|
+
/**
|
|
113
|
+
* A sentence naming the node, its type and what its schema said.
|
|
114
|
+
*
|
|
115
|
+
* The issue messages come from the declaring schema and can quote a rejected
|
|
116
|
+
* value, which `PropsIssue` warns about: this is content, and a consumer that
|
|
117
|
+
* puts it on a screen is putting a model's own words there. It is included
|
|
118
|
+
* anyway, because *this is too long* without *by how much, and which prop* is
|
|
119
|
+
* the refusal a repairer cannot act on.
|
|
120
|
+
*/
|
|
121
|
+
export declare const describeInvalidProps: (invalid: InvalidProps) => string;
|
|
122
|
+
//# sourceMappingURL=vocabulary.d.ts.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { walkTree } from "../tree/navigation.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a host that has declared no vocabulary gets, which is today's behaviour.
|
|
4
|
+
*
|
|
5
|
+
* It answers `true` for everything rather than `false`, and the asymmetry with
|
|
6
|
+
* `NOTHING_INTERACTIVE` is deliberate. Declaring nothing means *I have not told
|
|
7
|
+
* you what I can draw*, which is not the same claim as *I can draw nothing* —
|
|
8
|
+
* and a default that read the second way would refuse every insert on every
|
|
9
|
+
* deployment that has not opted in.
|
|
10
|
+
*/
|
|
11
|
+
export const EVERY_TYPE_REGISTERED = () => true;
|
|
12
|
+
/**
|
|
13
|
+
* The vocabulary a list of registered types describes.
|
|
14
|
+
*
|
|
15
|
+
* An empty list answers `EVERY_TYPE_REGISTERED` for the reason above: a policy
|
|
16
|
+
* field with an empty default is a host that has not spoken, and a host that
|
|
17
|
+
* has not spoken is not a host claiming an empty library.
|
|
18
|
+
*
|
|
19
|
+
* A `Set` rather than an object index, for the reason `interactivePredicateFor`
|
|
20
|
+
* gives: one lowercase segment is a whole namespaced id, so `constructor` is a
|
|
21
|
+
* legal primitive type, and an ordinary object would report it registered on a
|
|
22
|
+
* deployment that never registered it.
|
|
23
|
+
*/
|
|
24
|
+
export const primitiveVocabularyFor = (types) => {
|
|
25
|
+
if (types.length === 0)
|
|
26
|
+
return EVERY_TYPE_REGISTERED;
|
|
27
|
+
const registered = new Set(types);
|
|
28
|
+
return (type) => registered.has(type);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Every element in a subtree whose type the vocabulary does not hold, in
|
|
32
|
+
* document order.
|
|
33
|
+
*
|
|
34
|
+
* The whole subtree rather than its root, because an inserted band carries its
|
|
35
|
+
* own children and a hole three levels down is the same hole.
|
|
36
|
+
*/
|
|
37
|
+
export const unknownPrimitivesIn = (node, isRegistered) => Array.from(walkTree(node)).flatMap((current) => current.kind === "element" && !isRegistered(current.type)
|
|
38
|
+
? [{ nodeId: current.id, type: current.type }]
|
|
39
|
+
: []);
|
|
40
|
+
export const describeUnknownPrimitive = (unknown) => `${unknown.type} at ${unknown.nodeId}`;
|
|
41
|
+
/**
|
|
42
|
+
* What a host that has wired no props vocabulary gets, which is today's
|
|
43
|
+
* behaviour.
|
|
44
|
+
*
|
|
45
|
+
* `undeclared` rather than `valid`, and the distinction is not academic: the
|
|
46
|
+
* render seam already separates *these props are fine* from *nobody said what
|
|
47
|
+
* fine is*, and answering the first on a deployment that has declared nothing
|
|
48
|
+
* would be the runtime inventing a claim no schema made.
|
|
49
|
+
*/
|
|
50
|
+
export const EVERY_TYPE_UNDECLARED = () => ({ outcome: "undeclared" });
|
|
51
|
+
/**
|
|
52
|
+
* Every element in a subtree whose props its declaring primitive refuses, in
|
|
53
|
+
* document order.
|
|
54
|
+
*
|
|
55
|
+
* The whole subtree rather than its root, for the reason `unknownPrimitivesIn`
|
|
56
|
+
* gives: an inserted band carries its own children, and a node three levels
|
|
57
|
+
* down that will not draw is the same hole.
|
|
58
|
+
*
|
|
59
|
+
* Reserved props are not partitioned off first, unlike `renderElement`. A
|
|
60
|
+
* validator is handed what the node carries, and a schema that rejects a
|
|
61
|
+
* reserved key is a schema declaring something about a key the renderer never
|
|
62
|
+
* passes it — which is a fault in the declaration rather than in the change,
|
|
63
|
+
* and not one this seam is positioned to tell apart. `partitionReservedProps`
|
|
64
|
+
* lives behind the render boundary and importing it here would make the write
|
|
65
|
+
* path depend on the renderer's internals to answer a question about a tree.
|
|
66
|
+
*/
|
|
67
|
+
export const invalidPropsIn = (node, checkProps) => Array.from(walkTree(node)).flatMap((current) => {
|
|
68
|
+
if (current.kind !== "element")
|
|
69
|
+
return [];
|
|
70
|
+
const verdict = checkProps(current.type, current.props);
|
|
71
|
+
return verdict.outcome === "invalid"
|
|
72
|
+
? [{ nodeId: current.id, type: current.type, issues: verdict.issues }]
|
|
73
|
+
: [];
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* A sentence naming the node, its type and what its schema said.
|
|
77
|
+
*
|
|
78
|
+
* The issue messages come from the declaring schema and can quote a rejected
|
|
79
|
+
* value, which `PropsIssue` warns about: this is content, and a consumer that
|
|
80
|
+
* puts it on a screen is putting a model's own words there. It is included
|
|
81
|
+
* anyway, because *this is too long* without *by how much, and which prop* is
|
|
82
|
+
* the refusal a repairer cannot act on.
|
|
83
|
+
*/
|
|
84
|
+
export const describeInvalidProps = (invalid) => `${invalid.type} at ${invalid.nodeId} (${invalid.issues
|
|
85
|
+
.map((issue) => `${issue.path}: ${issue.message}`)
|
|
86
|
+
.join("; ")})`;
|
|
87
|
+
//# sourceMappingURL=vocabulary.js.map
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { DecorationLookup } from "../render/addressing.js";
|
|
2
|
+
import type { PrimitiveType } from "../primitive-type.js";
|
|
3
|
+
import type { BehaviourName } from "../render/behaviour.js";
|
|
4
|
+
import { type ConformanceVerdict, type PlacementVerdict, type ProbeAnswers, type ProbeFailure, type SubmissionVerdict } from "./conformance.js";
|
|
5
|
+
import type { PrimitiveRegistry } from "./registry.js";
|
|
6
|
+
/**
|
|
7
|
+
* The registration-time check, as a function a host calls rather than a side
|
|
8
|
+
* effect of building a registry (0010).
|
|
9
|
+
*
|
|
10
|
+
* The split matters. Probing calls every registered component once, and calling
|
|
11
|
+
* arbitrary components while a module graph is still evaluating is not something
|
|
12
|
+
* a library should do behind a host's back. So `createPrimitiveRegistry` stays
|
|
13
|
+
* pure and this runs where such things belong — in a test, or a build step, where
|
|
14
|
+
* a failure stops a release rather than a request.
|
|
15
|
+
*
|
|
16
|
+
* The audit reports; it does not decide. A primitive that ignores
|
|
17
|
+
* `loom.editable` renders correctly and is only invisible to the portal, so
|
|
18
|
+
* whether that blocks a deployment depends on whether the deployment has a
|
|
19
|
+
* portal. `notDecorated` is there to be asserted empty by a host that cares.
|
|
20
|
+
*
|
|
21
|
+
* Every probe runs under every configuration the primitive's schema closes over
|
|
22
|
+
* (0075) rather than under no props at all, because a primitive whose rendering
|
|
23
|
+
* turns on a prop — `loom.field` places children only when its `type` is
|
|
24
|
+
* `select` — was reported by the shape it takes at its default, which is a
|
|
25
|
+
* claim about one configuration wearing the name of the primitive.
|
|
26
|
+
*/
|
|
27
|
+
export type PrimitiveAudit = {
|
|
28
|
+
readonly type: PrimitiveType;
|
|
29
|
+
readonly verdict: ConformanceVerdict;
|
|
30
|
+
readonly placement: PlacementVerdict;
|
|
31
|
+
readonly submission: SubmissionVerdict;
|
|
32
|
+
/** What the author declared, beside what the probe saw. */
|
|
33
|
+
readonly declaresSubmits: boolean;
|
|
34
|
+
/** The props this primitive declared it frames (0095). Empty for almost all. */
|
|
35
|
+
readonly framesProps: readonly string[];
|
|
36
|
+
};
|
|
37
|
+
/** A primitive that declared a region and then did not render it. */
|
|
38
|
+
export type UnplacedSlots = {
|
|
39
|
+
readonly type: PrimitiveType;
|
|
40
|
+
readonly slots: readonly string[];
|
|
41
|
+
};
|
|
42
|
+
/** A primitive that took a control from the runtime and then did not place it. */
|
|
43
|
+
export type UnplacedBehaviours = {
|
|
44
|
+
readonly type: PrimitiveType;
|
|
45
|
+
readonly behaviours: readonly BehaviourName[];
|
|
46
|
+
};
|
|
47
|
+
/** A primitive that threw under some configuration its own schema accepts. */
|
|
48
|
+
export type ThrowingConfigurations = {
|
|
49
|
+
readonly type: PrimitiveType;
|
|
50
|
+
readonly failures: readonly ProbeFailure[];
|
|
51
|
+
/**
|
|
52
|
+
* Whether *nothing* the probe tried came back — the line between a fault the
|
|
53
|
+
* audit is certain of and one it is only reporting.
|
|
54
|
+
*
|
|
55
|
+
* `false`: some configurations rendered and this one threw, so the component
|
|
56
|
+
* is callable and a value its own schema accepts crashes it. Certain.
|
|
57
|
+
*
|
|
58
|
+
* `true`: every configuration threw, which is what a broken component and a
|
|
59
|
+
* hook-using one both look like from outside a renderer — and a hook-using
|
|
60
|
+
* component is a legitimate primitive (0012). A host with none of those
|
|
61
|
+
* asserts the whole list empty; one that ships them asserts the `false` half
|
|
62
|
+
* and reads the rest.
|
|
63
|
+
*/
|
|
64
|
+
readonly everyConfiguration: boolean;
|
|
65
|
+
};
|
|
66
|
+
export type RegistryAudit = {
|
|
67
|
+
readonly audits: readonly PrimitiveAudit[];
|
|
68
|
+
/** Registered, renders, invisible to the portal. */
|
|
69
|
+
readonly notDecorated: readonly PrimitiveType[];
|
|
70
|
+
/** The probe could not answer — neither a pass nor a failure. */
|
|
71
|
+
readonly notProbeable: readonly PrimitiveType[];
|
|
72
|
+
/**
|
|
73
|
+
* Declared a slot and dropped it. Unlike `notDecorated` this loses content
|
|
74
|
+
* rather than a handle, so a host with no portal at all still wants it empty.
|
|
75
|
+
*/
|
|
76
|
+
readonly unplacedSlots: readonly UnplacedSlots[];
|
|
77
|
+
/**
|
|
78
|
+
* Declared a behaviour and dropped its control. Like `unplacedSlots` this is
|
|
79
|
+
* a promise the registration made and the component did not keep — and unlike
|
|
80
|
+
* a slot, nothing else on the page hints that something is missing, because
|
|
81
|
+
* the content a behaviour acts on renders perfectly without it.
|
|
82
|
+
*/
|
|
83
|
+
readonly unplacedBehaviours: readonly UnplacedBehaviours[];
|
|
84
|
+
/**
|
|
85
|
+
* Renders no children — a leaf. Not a fault: `loom.stat` holds its value and
|
|
86
|
+
* label as props and has nowhere to put a text node. It is here because it is
|
|
87
|
+
* the one fact the renderer cannot derive, and a portal that offers "insert
|
|
88
|
+
* into this node" needs it to avoid offering a place nothing will appear.
|
|
89
|
+
*/
|
|
90
|
+
readonly leaves: readonly PrimitiveType[];
|
|
91
|
+
/**
|
|
92
|
+
* Threw on props built from its own schema. A fault whoever registered it
|
|
93
|
+
* wants to know about — a tree the validator accepts can take the page down —
|
|
94
|
+
* and never a reason to distrust the rest of this audit, which is answered by
|
|
95
|
+
* the configurations that did render.
|
|
96
|
+
*
|
|
97
|
+
* Every primitive that threw is here, including one that threw under *all* of
|
|
98
|
+
* them. That case used to reach only `notProbeable`, beside the class and
|
|
99
|
+
* hook-using components that are legitimate primitives (0012), so the most
|
|
100
|
+
* extreme instance of the fault this list exists for sat in the one list a
|
|
101
|
+
* host cannot assert empty. `everyConfiguration` marks it rather than hiding
|
|
102
|
+
* it.
|
|
103
|
+
*/
|
|
104
|
+
readonly throwsOnDeclaredProps: readonly ThrowingConfigurations[];
|
|
105
|
+
/**
|
|
106
|
+
* The registered primitives that post, as the probe observed them.
|
|
107
|
+
*
|
|
108
|
+
* This is the list a deployment holds its endpoint registry against: if
|
|
109
|
+
* anything here is registered, `renderRequest` wants `endpoints`, and a
|
|
110
|
+
* deployment that ships one without the other ships forms that render
|
|
111
|
+
* disabled. Derived rather than declared, so it is the truth about the
|
|
112
|
+
* components rather than the sum of their authors' intentions.
|
|
113
|
+
*/
|
|
114
|
+
readonly submits: readonly PrimitiveType[];
|
|
115
|
+
/**
|
|
116
|
+
* Places an address and never declared it posts. Not a broken page — the
|
|
117
|
+
* form works — but the declaration is what a deployment reads to know the
|
|
118
|
+
* seam is load-bearing here, so an undeclared submitter is a form whose need
|
|
119
|
+
* for an endpoint registry is invisible until someone fills it in.
|
|
120
|
+
*/
|
|
121
|
+
readonly undeclaredSubmitters: readonly PrimitiveType[];
|
|
122
|
+
/**
|
|
123
|
+
* Declared it posts and placed no address under any configuration probed.
|
|
124
|
+
* This is the failure the submission seam exists to prevent, caught one layer
|
|
125
|
+
* earlier than it would otherwise be: a submit control that goes nowhere
|
|
126
|
+
* renders, looks finished, and reports nothing until a visitor uses it.
|
|
127
|
+
*/
|
|
128
|
+
readonly unwiredSubmitters: readonly PrimitiveType[];
|
|
129
|
+
/**
|
|
130
|
+
* The registered primitives that put a prop in a frame.
|
|
131
|
+
*
|
|
132
|
+
* This is the list a deployment holds its framable-origin registry against,
|
|
133
|
+
* exactly as `submits` is held against its endpoint registry: if anything
|
|
134
|
+
* here is registered, `renderRequest` wants `origins`, and a deployment that
|
|
135
|
+
* ships one without the other ships embeds that render a refusal.
|
|
136
|
+
*
|
|
137
|
+
* Declared rather than probed, which is the one place this audit takes an
|
|
138
|
+
* author's word for something it could in principle check. It could not
|
|
139
|
+
* check this one usefully: the seam already refuses to register a `frames`
|
|
140
|
+
* naming a prop the schema does not declare, and the failure left over — a
|
|
141
|
+
* primitive that puts a URL in an `iframe` and never said so — is invisible
|
|
142
|
+
* to a probe, because an `iframe` a primitive built out of a prop it did not
|
|
143
|
+
* declare looks exactly like one it did. What would catch that is a lint over
|
|
144
|
+
* the markup, not a call of the component. Named here rather than left as a
|
|
145
|
+
* gap somebody discovers.
|
|
146
|
+
*/
|
|
147
|
+
readonly frames: readonly PrimitiveType[];
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* What the audit is told beyond the registry itself.
|
|
151
|
+
*
|
|
152
|
+
* One field, and it exists because a probe that can only ask a primitive
|
|
153
|
+
* questions about its props cannot see a bound one at all (0185). `loom.feed`
|
|
154
|
+
* draws rows, an empty region, and a line for a source that did not answer;
|
|
155
|
+
* probed with no answers it draws the third of those under every configuration
|
|
156
|
+
* its schema closes over, so a region it places only for the first two reads as
|
|
157
|
+
* a region nothing places.
|
|
158
|
+
*
|
|
159
|
+
* Keyed by primitive type, and absent for a primitive that reads no binding —
|
|
160
|
+
* which is ninety-six of the ninety-eight registered today, and every one of
|
|
161
|
+
* them audits exactly as it did before this field existed.
|
|
162
|
+
*/
|
|
163
|
+
export type RegistryAuditOptions = {
|
|
164
|
+
/**
|
|
165
|
+
* The answer states each type is probed in, beside the ones its own schema
|
|
166
|
+
* closes over.
|
|
167
|
+
*
|
|
168
|
+
* A `Map` rather than an object, because the key is a primitive type and a
|
|
169
|
+
* caller building one from `registry.primitives` has the branded strings
|
|
170
|
+
* already — and because a lookup on an object literal is a lookup on
|
|
171
|
+
* `Object.prototype` for any name that happens to be on it.
|
|
172
|
+
*/
|
|
173
|
+
readonly answers?: ReadonlyMap<PrimitiveType, readonly ProbeAnswers[]>;
|
|
174
|
+
};
|
|
175
|
+
export declare const auditRegistry: (registry: PrimitiveRegistry, options?: RegistryAuditOptions) => RegistryAudit;
|
|
176
|
+
/**
|
|
177
|
+
* The audit, as the predicate `addressNode` needs.
|
|
178
|
+
*
|
|
179
|
+
* Two judgement calls, both erring the same way — towards claiming a node is
|
|
180
|
+
* addressable — because the DOM is the final authority and a portal that queries
|
|
181
|
+
* for a handle can degrade when it misses. Refusing to point at a node that is in
|
|
182
|
+
* fact there would be the worse failure: it is silent, and it makes a working
|
|
183
|
+
* primitive look broken.
|
|
184
|
+
*
|
|
185
|
+
* - `not-probeable` counts as decorating. The probe said it could not answer,
|
|
186
|
+
* which is not the same as answering no.
|
|
187
|
+
* - a type absent from the audit counts as *not* decorating, and that is not
|
|
188
|
+
* erring the other way: an unregistered type renders as nothing at all, so its
|
|
189
|
+
* whole subtree is missing from the DOM and delegating to an ancestor is
|
|
190
|
+
* exactly right.
|
|
191
|
+
*/
|
|
192
|
+
export declare const decorationFromAudit: (audit: RegistryAudit) => DecorationLookup;
|
|
193
|
+
/** One line per primitive, for a CLI or a failing test's message. */
|
|
194
|
+
export declare const describeRegistryAudit: (audit: RegistryAudit) => string;
|
|
195
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { describeProbeFailures, probeConfigurations, probeEditableDecoration, probePlacement, probeStates, probeSubmissionPlacement, } from "./conformance.js";
|
|
2
|
+
const unplacedIn = (placement) => placement.outcome === "probed" ? placement.unplacedSlots : [];
|
|
3
|
+
const unplacedBehavioursIn = (placement) => placement.outcome === "probed" ? placement.unplacedBehaviours : [];
|
|
4
|
+
/**
|
|
5
|
+
* The throwing configurations a placement verdict saw, from whichever branch it
|
|
6
|
+
* came back on. A verdict that declined because *everything* threw holds the
|
|
7
|
+
* same failures as one that answered despite some of them; only `not-callable`
|
|
8
|
+
* has none, because nothing was called.
|
|
9
|
+
*/
|
|
10
|
+
const throwingIn = (type, placement) => {
|
|
11
|
+
const failures = placement.outcome === "probed" ? placement.threw : placement.failures;
|
|
12
|
+
if (failures.length === 0)
|
|
13
|
+
return [];
|
|
14
|
+
return [{ type, failures, everyConfiguration: placement.outcome === "not-probeable" }];
|
|
15
|
+
};
|
|
16
|
+
const NO_ANSWERS = Object.freeze([]);
|
|
17
|
+
export const auditRegistry = (registry, options = {}) => {
|
|
18
|
+
const audits = registry.primitives.map((primitive) => {
|
|
19
|
+
const configurations = probeStates(probeConfigurations(primitive.choices), options.answers?.get(primitive.type) ?? NO_ANSWERS);
|
|
20
|
+
return {
|
|
21
|
+
type: primitive.type,
|
|
22
|
+
verdict: probeEditableDecoration(primitive.component, primitive.text, configurations, primitive.frames),
|
|
23
|
+
placement: probePlacement(primitive.component, primitive.slots, primitive.text, configurations, primitive.behaviours, primitive.frames),
|
|
24
|
+
submission: probeSubmissionPlacement(primitive.component, primitive.text, configurations, primitive.frames),
|
|
25
|
+
declaresSubmits: primitive.submits,
|
|
26
|
+
framesProps: primitive.frames,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const places = (audit) => audit.submission.outcome === "places";
|
|
30
|
+
return {
|
|
31
|
+
audits,
|
|
32
|
+
submits: audits.filter(places).map((audit) => audit.type),
|
|
33
|
+
frames: audits.filter((audit) => audit.framesProps.length > 0).map((audit) => audit.type),
|
|
34
|
+
undeclaredSubmitters: audits
|
|
35
|
+
.filter((audit) => places(audit) && !audit.declaresSubmits)
|
|
36
|
+
.map((audit) => audit.type),
|
|
37
|
+
/**
|
|
38
|
+
* `not-probeable` is not counted as unwired, for the reason
|
|
39
|
+
* `decorationFromAudit` gives: the probe said it could not answer, which is
|
|
40
|
+
* not the same as answering no, and a claim of a broken form is not one to
|
|
41
|
+
* make on silence.
|
|
42
|
+
*/
|
|
43
|
+
unwiredSubmitters: audits
|
|
44
|
+
.filter((audit) => audit.declaresSubmits && audit.submission.outcome === "not-placed")
|
|
45
|
+
.map((audit) => audit.type),
|
|
46
|
+
notDecorated: audits.filter((audit) => audit.verdict.outcome === "not-decorated").map((audit) => audit.type),
|
|
47
|
+
notProbeable: audits.filter((audit) => audit.verdict.outcome === "not-probeable").map((audit) => audit.type),
|
|
48
|
+
unplacedSlots: audits
|
|
49
|
+
.filter((audit) => unplacedIn(audit.placement).length > 0)
|
|
50
|
+
.map((audit) => ({ type: audit.type, slots: unplacedIn(audit.placement) })),
|
|
51
|
+
unplacedBehaviours: audits
|
|
52
|
+
.filter((audit) => unplacedBehavioursIn(audit.placement).length > 0)
|
|
53
|
+
.map((audit) => ({ type: audit.type, behaviours: unplacedBehavioursIn(audit.placement) })),
|
|
54
|
+
leaves: audits
|
|
55
|
+
.filter((audit) => audit.placement.outcome === "probed" && !audit.placement.rendersChildren)
|
|
56
|
+
.map((audit) => audit.type),
|
|
57
|
+
throwsOnDeclaredProps: audits.flatMap((audit) => throwingIn(audit.type, audit.placement)),
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The audit, as the predicate `addressNode` needs.
|
|
62
|
+
*
|
|
63
|
+
* Two judgement calls, both erring the same way — towards claiming a node is
|
|
64
|
+
* addressable — because the DOM is the final authority and a portal that queries
|
|
65
|
+
* for a handle can degrade when it misses. Refusing to point at a node that is in
|
|
66
|
+
* fact there would be the worse failure: it is silent, and it makes a working
|
|
67
|
+
* primitive look broken.
|
|
68
|
+
*
|
|
69
|
+
* - `not-probeable` counts as decorating. The probe said it could not answer,
|
|
70
|
+
* which is not the same as answering no.
|
|
71
|
+
* - a type absent from the audit counts as *not* decorating, and that is not
|
|
72
|
+
* erring the other way: an unregistered type renders as nothing at all, so its
|
|
73
|
+
* whole subtree is missing from the DOM and delegating to an ancestor is
|
|
74
|
+
* exactly right.
|
|
75
|
+
*/
|
|
76
|
+
export const decorationFromAudit = (audit) => {
|
|
77
|
+
const verdicts = new Map(audit.audits.map((entry) => [entry.type, entry.verdict.outcome]));
|
|
78
|
+
return (type) => {
|
|
79
|
+
const outcome = verdicts.get(type);
|
|
80
|
+
return outcome !== undefined && outcome !== "not-decorated";
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const describeVerdict = (verdict) => {
|
|
84
|
+
switch (verdict.outcome) {
|
|
85
|
+
case "decorates":
|
|
86
|
+
return "spreads loom.editable";
|
|
87
|
+
case "not-decorated":
|
|
88
|
+
return "does not spread loom.editable — it will be invisible to the portal";
|
|
89
|
+
case "not-probeable":
|
|
90
|
+
return `could not be probed (${verdict.reason})`;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const describePlacement = (placement) => {
|
|
94
|
+
if (placement.outcome === "not-probeable")
|
|
95
|
+
return `placement not probed (${placement.reason})`;
|
|
96
|
+
if (placement.unplacedSlots.length > 0) {
|
|
97
|
+
return `declares ${placement.unplacedSlots.join(", ")} and does not place ${placement.unplacedSlots.length === 1 ? "it" : "them"}`;
|
|
98
|
+
}
|
|
99
|
+
if (placement.unplacedBehaviours.length > 0) {
|
|
100
|
+
return `takes the ${placement.unplacedBehaviours.join(", ")} behaviour and does not place ${placement.unplacedBehaviours.length === 1 ? "its control" : "their controls"}`;
|
|
101
|
+
}
|
|
102
|
+
const under = placement.probed.length === 1 ? "" : ` under all ${placement.probed.length} configurations probed`;
|
|
103
|
+
const children = placement.rendersChildren
|
|
104
|
+
? "renders its children"
|
|
105
|
+
: `renders no children (a leaf)${under}`;
|
|
106
|
+
if (placement.threw.length === 0)
|
|
107
|
+
return children;
|
|
108
|
+
return `${children}; threw on ${describeProbeFailures(placement.threw)}`;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Said only when there is something to say. Every primitive decorates and every
|
|
112
|
+
* primitive places or does not, so those two are worth a clause each on every
|
|
113
|
+
* line; posting is the exception, and a clause reading "does not post" on fifty
|
|
114
|
+
* lines would bury the one line that matters.
|
|
115
|
+
*/
|
|
116
|
+
const describeSubmission = (entry) => {
|
|
117
|
+
if (entry.submission.outcome === "not-probeable")
|
|
118
|
+
return "";
|
|
119
|
+
if (entry.submission.outcome === "places") {
|
|
120
|
+
return entry.declaresSubmits ? "; posts" : "; posts, and does not declare `submits`";
|
|
121
|
+
}
|
|
122
|
+
return entry.declaresSubmits ? "; declares `submits` and places no address" : "";
|
|
123
|
+
};
|
|
124
|
+
/** One line per primitive, for a CLI or a failing test's message. */
|
|
125
|
+
export const describeRegistryAudit = (audit) => audit.audits
|
|
126
|
+
.map((entry) => `${entry.type}: ${describeVerdict(entry.verdict)}; ${describePlacement(entry.placement)}${describeSubmission(entry)}`)
|
|
127
|
+
.join("\n");
|
|
128
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { PrimitiveCatalogue } from "../catalogue.js";
|
|
2
|
+
import type { PrimitiveRegistry } from "./registry.js";
|
|
3
|
+
/**
|
|
4
|
+
* The one function that turns a registry into something that can leave the
|
|
5
|
+
* process.
|
|
6
|
+
*
|
|
7
|
+
* Everything a model, a telemetry record or another service is told about a
|
|
8
|
+
* deployment's primitives comes through here.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The shape of what `catalogueOf` hands back, carried by the same entry point.
|
|
12
|
+
*
|
|
13
|
+
* Without this a host writing a function over the answer imports the function
|
|
14
|
+
* from `@jam-overture/loom/sdk` and the type of its result from `@jam-overture/loom`. Both
|
|
15
|
+
* are public doors and nothing was blocked, but it is a paper cut met in the
|
|
16
|
+
* first hour — found writing a page that prints one catalogue entry.
|
|
17
|
+
*
|
|
18
|
+
* Three names rather than `export type *`, which is what was asked for and is
|
|
19
|
+
* not what this should be: the reference generator resolves a star re-export by
|
|
20
|
+
* walking the target module, and does not honour the `type` modifier. Starring
|
|
21
|
+
* put `catalogueFields` and `closedChoices` on the published page as functions
|
|
22
|
+
* this door offers, and the door does not offer them — they are values, so
|
|
23
|
+
* `export type *` never carried them and `sdk.catalogueFields` is `undefined`.
|
|
24
|
+
* Naming the three types the catalogue is made of says the true thing in a way
|
|
25
|
+
* the generator reads correctly.
|
|
26
|
+
*/
|
|
27
|
+
export type { CataloguedPrimitive, CataloguedProp, PrimitiveCatalogue } from "../catalogue.js";
|
|
28
|
+
/**
|
|
29
|
+
* The registry, projected into the catalogue other components read.
|
|
30
|
+
*
|
|
31
|
+
* A projection rather than the registry itself, because the registry holds
|
|
32
|
+
* components and closures — things that cannot be serialised, sent to a model,
|
|
33
|
+
* or recorded in telemetry. What survives the projection is exactly what a
|
|
34
|
+
* consumer outside this process can act on.
|
|
35
|
+
*/
|
|
36
|
+
export declare const catalogueOf: (registry: PrimitiveRegistry) => PrimitiveCatalogue;
|
|
37
|
+
//# sourceMappingURL=catalogue.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The registry, projected into the catalogue other components read.
|
|
3
|
+
*
|
|
4
|
+
* A projection rather than the registry itself, because the registry holds
|
|
5
|
+
* components and closures — things that cannot be serialised, sent to a model,
|
|
6
|
+
* or recorded in telemetry. What survives the projection is exactly what a
|
|
7
|
+
* consumer outside this process can act on.
|
|
8
|
+
*/
|
|
9
|
+
export const catalogueOf = (registry) => registry.primitives.map((primitive) => ({
|
|
10
|
+
type: primitive.type,
|
|
11
|
+
description: primitive.description,
|
|
12
|
+
props: primitive.declaredProps,
|
|
13
|
+
slots: primitive.slots,
|
|
14
|
+
reads: primitive.reads,
|
|
15
|
+
}));
|
|
16
|
+
//# sourceMappingURL=catalogue.js.map
|