Skip to content

refactor: extend DurableObject base class to unlock RPC#167

Open
kptdobe wants to merge 1 commit into
mainfrom
fix/do-extend-base-class
Open

refactor: extend DurableObject base class to unlock RPC#167
kptdobe wants to merge 1 commit into
mainfrom
fix/do-extend-base-class

Conversation

@kptdobe
Copy link
Copy Markdown
Contributor

@kptdobe kptdobe commented Jun 2, 2026

The modern Cloudflare Durable Objects pattern requires extending the `DurableObject` base class from `cloudflare:workers`. This is also a prerequisite for enabling RPC — direct method calls on DO stubs instead of round-tripping through `fetch()`. The current code acknowledges this limitation in a TODO comment.

Changes

  • `DocRoom` now extends `DurableObject` — `this.ctx` and `this.env` are set by the base class constructor
  • Removes manual `this.storage`, `this.env`, `this.ctx`, and unused `this.id` assignments from the constructor
  • Adds `cloudflare:workers` module stub and Node.js module hook so the existing Mocha test suite continues to work

🤖 Generated with Claude Code

…test stub

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant