package caps import ( "encoding/json" "github.com/google/uuid" ) // parseUUID parses a canonical UUID string, returning uuid.Nil for empty or // malformed input (host-side values are always canonical; this mirrors the // tolerant decode the render-context shim uses). func parseUUID(s string) uuid.UUID { if s == "" { return uuid.Nil } id, err := uuid.Parse(s) if err != nil { return uuid.Nil } return id } // unmarshalMap decodes a JSON object into map[string]any, returning nil for // empty or undecodable input (callers treat absent maps as nil). func unmarshalMap(raw []byte) map[string]any { if len(raw) == 0 { return nil } var m map[string]any if err := json.Unmarshal(raw, &m); err != nil { return nil } return m }