jmap-metadata-types 0.4.2

JMAP Object Metadata extension data types (draft-ietf-jmap-metadata-*)
Documentation
//! JMAP Object Metadata extension data types.
//!
//! Implements the data types defined in
//! [draft-ietf-jmap-metadata-04](https://datatracker.ietf.org/doc/draft-ietf-jmap-metadata/).
//! Types only — no method handlers, no async, no network I/O.
//!
//! ## Architecture change from -01 to -02
//!
//! Since -02, the draft has no standalone `Metadata` object type. Instead,
//! each listed data type gains `metadata` (shared) and `privateMetadata`
//! (per-user) properties — plain `String[Object]` maps keyed by namespace
//! identifier.
//!
//! This crate provides the helper types that consumers need:
//!
//! - Crate root — [`DataTypeMetadataInfo`], [`JMAP_METADATA_URI`] (§1.2.1)
//! - `filter` — [`MetadataTextMatch`], [`WithMetadata`] (§3.6)
//! - `namespace` — namespace identifier validation (§2.1)
//!
//! All public types and functions are re-exported at the crate root.
//!
//! # Example
//!
//! ```rust
//! use jmap_metadata_types::{DataTypeMetadataInfo, is_valid_namespace};
//!
//! // Server advertises per-type metadata capability
//! let json = r#"{
//!     "namespaces": ["photography"],
//!     "supportsVendorNamespaces": false,
//!     "supportsPrivate": false,
//!     "maxDepth": 3
//! }"#;
//! let info: DataTypeMetadataInfo = serde_json::from_str(json).unwrap();
//! assert_eq!(info.namespaces, vec!["photography"]);
//! assert_eq!(info.max_depth, Some(3));
//!
//! // Validate namespace identifiers
//! assert!(is_valid_namespace("photography"));       // registered
//! assert!(is_valid_namespace("acme.example.com"));  // vendor domain
//! assert!(!is_valid_namespace(""));                 // empty
//! ```

#![forbid(unsafe_code)]

mod capability;
mod filter;
mod namespace;

pub use capability::{DataTypeMetadataInfo, JMAP_METADATA_URI};
pub use filter::{MetadataTextMatch, WithMetadata};
pub use namespace::{is_registered_namespace, is_valid_namespace, is_vendor_namespace};