Expand description
Typed newtype identifiers for systemprompt.io.
Every entity in the platform is referenced through a wrapper newtype
rather than a raw String.
This crate provides both the macros that generate those wrappers
(define_id!, define_token!) and the canonical concrete types
(UserId, AgentId, TaskId, TraceId, ContextId, SessionId,
McpServerId, …).
Boundary types for talking to the database — DbValue, ToDbValue,
FromDbValue, JsonRow — also live here so that identifier modules
can interoperate without depending on the database crate.
§Construction
ⓘ
use systemprompt_identifiers::{TaskId, UserId};
// Known string value (literal, parsed input, DB row).
let user = UserId::new("user_abc");
// Mint a fresh UUID-backed identifier.
let task = TaskId::generate();Validated identifiers (McpServerId, Email, ProfileName,
ValidatedUrl, ValidatedFilePath, AgentName) additionally expose a
fallible try_new constructor returning error::IdValidationError.
§Feature flags
| Feature | Effect |
|---|---|
| (default) | Pure-Rust types only. |
sqlx | Derives sqlx::Type on every identifier, allowing direct binding in query_as! macros. |
Re-exports§
pub use db_value::DbValue;pub use db_value::FromDbValue;pub use db_value::JsonRow;pub use db_value::ToDbValue;pub use db_value::parse_database_datetime;
Modules§
- db_
value - Database-value abstraction shared between repository code and the identifier crate.
- error
- Error types raised by identifier validation and database value conversion.
- headers
- Canonical HTTP header name constants used throughout the platform for propagating trace, session, and authorization context across services.
- macros
- Declarative macros that generate the typed identifier and token newtypes.
Macros§
Structs§
- Access
Token Id - AgentId
- Agent
Name - AiGateway
Policy Id - AiQuota
Bucket Id - AiRequest
Id - AiSafety
Finding Id - AiTool
Call Id - ApiKey
Id - ApiKey
Secret - Artifact
Id - Authorization
Code - Campaign
Id - Category
Id - Challenge
Id - Checkout
Session Id - Client
Id - Cloud
Auth Token - Config
Id - Connection
Id - Content
Id - Context
Id - Device
Cert Id - Engagement
Event Id - Execution
Step Id - FileId
- Funnel
Id - Funnel
Progress Id - HookId
- JobName
- JwtToken
- Link
Click Id - LinkId
- LogId
- McpExecution
Id - McpServer
Id - Message
Id - Plugin
Id - Policy
Version - PriceId
- Profile
Name - Refresh
Token Id - RoleId
- Scheduled
JobId - Section
Id - Session
Id - Session
Token - SkillId
- Source
Id - TagId
- TaskId
- Tenant
Id - TokenId
- TraceId
- Transaction
Id - UserId
- Validated
File Path - Validated
Url - Webhook
Endpoint Id