17.1 What the hub registers
Every document that reaches the hub now has to be one of these, each under an id with a prefix of its own:
| Prefix | Whose | Where from |
|---|---|---|
trax_client_ | the storefront's | web/src/graphql/, through trax.documents.json (chapter 15) |
trax_machine_ | the checkout machine's operations | generated by the hub for every machine it serves |
trax_progress_ | runProgress, its query and its subscription | generated by the hub for trains marked [TraxRunProgress] |
trax_console_ | the operations console's | shipped inside Trax.Api.Dashboard, registered by UseTraxApiDashboard |
The storefront already sends nothing else, and the console sends its documents by id whenever the hub runs persisted operations, as it has since chapter 12. Neither changes.
The ids are what make a refusal safe. A document's id is a hash of its text, so an id names exactly
one document, and the hub checked each one against its schema and its rules when it started. A
caller can choose which registered document to run and with which variables, and nothing else.
Who may run each one is still decided by [TraxAuthorize] and the operations gate, as before:
persisted operations decide what can be asked, not who may ask it.
Next: 17.2 Make the hub refuse