Skip to main content

Crate purwa_inertia

Crate purwa_inertia 

Source
Expand description

Inertia.js protocol v1.3 adapter for Purwa (first-party; no third-party Inertia crate).

§MVP (Sprint 6)

  • InertiaRequest extractor: reads X-Inertia, version, and partial-reload headers.
  • InertiaRequest::respond: returns JSON for Inertia visits or an HTML skeleton for the first full-page load (embeds the page object in a <script type="application/json">).
  • 409 Conflict on GET when X-Inertia-Version differs from the server asset version (purwa_core::InertiaSection::asset_version), with X-Inertia-Location set for a full reload.
  • Partial reloads: X-Inertia-Partial-Component must match the rendered component; then X-Inertia-Partial-Except wins over X-Inertia-Partial-Data; errors is always included.
  • SharedProps + shared::ensure_shared_props middleware merge props into every page.

Vite + Svelte: use vite_manifest for full-page <script> / <link> tags and InertiaRenderContext::html_body_injection in InertiaRequest::respond.

Errors (Sprint 10): InertiaRequest::respond_purwa_error renders purwa_core::PurwaError as the shared INERTIA_ERROR_COMPONENT page (e.g. Pages/Error.svelte).

Re-exports§

pub use shared::SharedProps;
pub use shared::ensure_shared_props;
pub use shared::seed_shared_props_from_config;

Modules§

headers
Inertia request/response header names (protocol v1.3).
shared
Per-request shared props merged into every Inertia page object.
vite_manifest
Parse Vite/Rollup manifest.json and emit <script> / <link> tags for full-page HTML.

Structs§

InertiaRenderContext
Request-scoped values for InertiaRequest::respond (keeps the handler signature small).
InertiaRequest
Parsed Inertia-related headers for one request.

Constants§

INERTIA_ERROR_COMPONENT
Default Svelte page name for InertiaRequest::respond_purwa_error.