Skip to main content

Crate makeshop_extensions

Crate makeshop_extensions 

Source
Expand description

SDK for implementing makeshop guest extensions in Rust.

A guest implements exactly one entrypoint. Enable the Cargo feature for that entrypoint and annotate its function with hook or event; the attribute generates the component wiring. Enabling several entrypoint features at once fails to build, because their host imports would be mixed into one component.

The package is named makeshop-extensions-sdk and is imported as makeshop_extensions.

§Hooks and events

A hook interrupts the surrounding operation: it runs synchronously, and the value it returns decides what happens next. An event is a delivery: a failed handler is retried, and a handler that gives up sends the delivery to dead-letter, so an event handler must be idempotent. Annotating an entrypoint with the wrong attribute is a compile error that names the other one.

§Contract versions

The -vN suffix of an entrypoint feature is the major version of its contract, which moves independently of the crate version. A contract is not rewritten in place: a new major arrives as an additional feature, so migrating changes one line in Cargo.toml. There is no unsuffixed alias meaning “the latest contract”, so a rebuild alone never changes the contract a guest is built against.

§Host APIs and tests

host provides connector calls, execution context, UUID generation, and runtime logging as canonical SDK types rather than per-entrypoint bindings, so guest code reads the same across entrypoints. Endpoints, credentials, retries, and default headers come from the deployment configuration; a guest names a connector and builds a body.

The attributes expand to component wiring only for wasm32 targets, so in a native build an entrypoint stays an ordinary function that cargo test can call. testing provides the harness that supplies connector responses, an execution context, and log capture.

Re-exports§

pub use content_blocks;

Modules§

finalize_checkout_validation
Input and output types and helpers for the finalize_checkout_validation hook.
host
Host APIs provided by the runtime.
order_completed
Input and output types and helpers for the order_completed event.
order_completed_content
Input and output types for the order_completed_content hook.
testing
APIs for unit-testing guest extensions.

Attribute Macros§

event
Declares an event entrypoint.
hook
Declares a hook entrypoint.