cloudflare/partykit partyserver@0.5.2
cloudflare/partykit
Captured source
source ↗partyserver@0.5.2
Repository: cloudflare/partykit
Tag: partyserver@0.5.2
Published: 2026-04-24T22:24:50Z
Prerelease: no
Release notes:
Patch Changes
- #383 `fe030f6` Thanks @threepointone! -
setName()is now the sanctioned bootstrap API for non-idFromNameDOs.
When ctx.id.name is undefined (e.g. Cloudflare Agents facets, which are spawned via ctx.facets.get(...) rather than idFromName()), setName(name) now persists the name to the legacy __ps_name storage key in addition to stashing it in memory. This means cold-wake invocations of the DO recover the name through #ensureInitialized()'s legacy storage fallback without the framework having to reach into PartyServer's private storage layout.
Frameworks that previously did:
await this.ctx.storage.put("__ps_name", name);
await this.__unsafe_ensureInitialized();can now do:
await this.setName(name);
Backward compatible:
- For DOs addressed via
idFromName()/getByName()(the happy path),setName()continues to NOT write storage —ctx.id.nameis the source of truth andsetName()is just a no-op-plus-onStart. - The pre-existing direct-storage-write pattern keeps working — the storage write becomes idempotent with what
setName()would do.
setName()'s @deprecated docblock has been clarified: it remains the supported API for framework-level bootstrap of non-idFromName DOs and for delivering initial props to onStart(). The deprecation only applies to redundant calls on DOs that were addressed via idFromName().