Tutorial

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:

PrefixWhoseWhere from
trax_client_the storefront'sweb/src/graphql/, through trax.documents.json (chapter 15)
trax_machine_the checkout machine's operationsgenerated by the hub for every machine it serves
trax_progress_runProgress, its query and its subscriptiongenerated by the hub for trains marked [TraxRunProgress]
trax_console_the operations console'sshipped 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