Skip to content

feat(cloudflare): use functions instead of classes for static bindings #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 14, 2025

Conversation

sam-goodwin
Copy link
Owner

@sam-goodwin sam-goodwin commented Jul 7, 2025

Closes #567

Migration to Function-Based API

Migrated several Cloudflare bindings from class-based to function-based syntax for consistency across the codebase. This change affects the following bindings:

Usage Changes

Before:

const ai = new Ai()
const analytics = new AnalyticsEngineDataset("analytics", {...})
const browser = new BrowserRendering()
const durable = new DurableObjectNamespace("namespace", {...})
const images = new Images()
const metadata = new VersionMetadata()
const workflow = new Workflow("workflow", {...})

After:

const ai = Ai()
const analytics = AnalyticsEngineDataset("analytics", {...})
const browser = BrowserRendering()
const durable = DurableObjectNamespace("namespace", {...})
const images = Images()
const metadata = VersionMetadata()
const workflow = Workflow("workflow", {...})

No functional changes were made - this is purely a syntactic update for consistency. All types and runtime behavior remain the same.

Copy link

pkg-pr-new bot commented Jul 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/sam-goodwin/alchemy@588

commit: b06c3c9

Copy link

github-actions bot commented Jul 7, 2025

🚀 Website Preview Deployed

Your website preview is ready!

Preview URL: https://7d76b10d-alchemy-website.alchemy-run.workers.dev

This preview was built from commit dc4daf8


🤖 This comment will be updated automatically when you push new commits to this PR.

@sam-goodwin sam-goodwin merged commit 819f626 into main Jul 14, 2025
1 of 4 checks passed
@sam-goodwin sam-goodwin deleted the sam/remove-classes branch July 14, 2025 05:30
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.

Use functions (async or sync) for binding classes like DurableObjectNamespace
1 participant