partyserver@0.5.2
Patch Changes
-
#383
fe030f6Thanks @threepointone! -setName()is now the sanctioned bootstrap API for non-idFromNameDOs.When
ctx.id.nameis undefined (e.g. Cloudflare Agents facets, which are spawned viactx.facets.get(...)rather thanidFromName()),setName(name)now persists the name to the legacy__ps_namestorage 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@deprecateddocblock has been clarified: it remains the supported API for framework-level bootstrap of non-idFromNameDOs and for delivering initialpropstoonStart(). The deprecation only applies to redundant calls on DOs that were addressed viaidFromName(). - For DOs addressed via