Skip to content

Split backend connector interface - #1149

Merged
simolus3 merged 10 commits into
mainfrom
split-connector-interface
Oct 29, 2026
Merged

simolus3 merged 10 commits into
mainfrom
split-connector-interface

Conversation

@simolus3

Copy link
Copy Markdown
Contributor

This implements the backend connector split: Instead of extending PowerSyncBackendConnector and passing it to connect in a single object, this allows implementing Authenticator and MutationUploader (a simple callback) directly. These two objects can be passed to connect() separately:

// Download-only
await database.connect({
  powerSyncEndpoint: 'https://<...>.powersync.com',
  authenticator: myAuthenticator
});

// Upload-only
await database.connect({
  async upload() {}
});

// Downloads and uploads
await database.connect({
  powerSyncEndpoint: 'https://<...>.powersync.com',
  authenticator: myAuthenticator,
  async upload() {}
});

Being able to connect for uploads and downloads individually makes the first setup easier and more incremental. It also allows composing different authenticators and uploaders better. Additionally, resolveCredentials and the upload callback now receive an abort signal.

Finally, an authenticator is allowed to return cached tokens and has an optional invalidateCredentials method the SDK uses to inform it about expired tokens.

This is implemented via an overload on connect, so existing calls continue to work unchanged. On the web, multiple tabs connecting to the same shared worker must agree on the connection mode.

AI use: Parts of the tests and web changes implemented with Claude Code.

@changeset-bot

changeset-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ba0ade4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@powersync/react-native Minor
@powersync/capacitor Minor
@powersync/common Minor
@powersync/node Minor
@powersync/web Minor
@powersync/nuxt Minor
@powersync/tanstack-react-query Patch
@powersync/diagnostics-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simolus3
simolus3 force-pushed the split-connector-interface branch from 780d7df to 9d28c5d Compare October 26, 2026 09:59
@simolus3
simolus3 marked this pull request as ready for review October 26, 2026 10:11
@simolus3
simolus3 force-pushed the split-connector-interface branch from 9d28c5d to 23329d4 Compare October 28, 2026 13:30
@simolus3 simolus3 added the Product Visibility This requires documentation changes and or announcing. label Oct 28, 2026
@simolus3
simolus3 force-pushed the split-connector-interface branch 3 times, most recently from 1b0587d to f8205de Compare October 28, 2026 20:12
@simolus3
simolus3 force-pushed the split-connector-interface branch from b069f0a to ba0ade4 Compare October 29, 2026 08:22
@simolus3
simolus3 requested a review from Chriztiaan October 29, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product Visibility This requires documentation changes and or announcing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants