MessageId
MessageId: (
value?) =>MessageId
Defined in: packages/protocol/src/lib/message.ts:18
Creates or brands a MessageId. Smart constructor — same pattern as SessionId.
- Called with no arguments: generates a new unique Nano ID (no prefix).
- Called with an existing string: brands it as a MessageId without changing its value. Use this when rehydrating from serialized data.
Parameters
Section titled “Parameters”value?
Section titled “value?”string
Returns
Section titled “Returns”Example
Section titled “Example”const fresh = MessageId(); // new Nano IDconst echoed = MessageId(input.id); // brands an existing id