Using this API in a worker you can convert a string name into an ID to get the DO stub object:
let id = OBJECT_NAMESPACE.idFromName(name);
But when my DO is running, how do I get name from itself?
The API here only returns the hex ID:
Is there an API or env var?
Getting the name of the Durable Object is important as external systems index the data associated with the Durable Object by name, not by the non-human-readable hex ID. The name needs to be read from inside the Durable Object so that when sending the data to another system (central database/for backups) it can be indexed by Durable Object name.