Documentation
¶
Overview ¶
Package hooks is a small FHIR intercept SPI for HAIStack.
HAPI's interceptor bus has dozens of pointcuts. This package keeps four:
- Incoming — HTTP request after routing, before the handler runs
- PreStorage — core write path, after validation/id assignment, before persist
- PostCommit — core write path, after the write session commits
- Outgoing — HTTP response, before a resource envelope is serialized
Register Func values on a Registry with On, then wire the same Registry into core.ResourceServiceConfig.Hooks and http.Config.Hooks (runtime.Builder.WithHooks does both). Hooks run in registration order. Incoming, pre-storage, and outgoing errors abort the request; post-commit errors are ignored so a successful write is not reported as failure.
Do not add more pointcuts here. Extend by registering another Func on one of these four, or by wrapping HTTP middleware for transport concerns.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
Action names the FHIR interaction that triggered the hook.
const ( ActionRead Action = "read" ActionCreate Action = "create" ActionUpdate Action = "update" ActionPatch Action = "patch" ActionDelete Action = "delete" ActionSearch Action = "search" ActionHistory Action = "history" ActionTransaction Action = "transaction" ActionBatch Action = "batch" ActionOperation Action = "operation" ActionMetadata Action = "metadata" )
type Event ¶
type Event struct {
Point Point
Action Action
ResourceType string
ID string
Operation string
Resource *types.ResourceEnvelope
Previous *types.ResourceEnvelope
}
Event is the payload delivered to a hook. Resource is mutable on pre-storage and outgoing so a hook can replace or annotate it.