Repository navigation
fix(kysely-driver): export the database, dialect and driver classes - #1202
Open
shahjahanpak wants to merge 1 commit into
Open
shahjahanpak wants to merge 1 commit into
shahjahanpak wants to merge 1 commit into
Conversation
PowerSyncKyselyDatabase was re-exported from a type-only import, so it was undefined at runtime and could not be extended or constructed. PowerSyncDialect and PowerSyncDriver were not exported at all. Export all three as values, with their option types. Fixes powersync-ja#1194 Co-Authored-By: Claude Opus 5.5 <[email protected]>
🦋 Changeset detectedLatest commit: aa58805 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1194
packages/kysely-driver/src/index.tsimportedPowerSyncKyselyDatabasewithtype, then listed it in theexport { … }block. So the package exported it as a type only. At runtime it isundefined:class AppDatabase extends PowerSyncKyselyDatabasethrowsClass extends value undefined is not a constructor or null.PowerSyncDialectandPowerSyncDriverwere not exported at all, so an app could not build its ownKyselyinstance on the PowerSync dialect, for example to add plugins.The index now imports
PowerSyncKyselyDatabaseas a value, and also exportsPowerSyncDialectandPowerSyncDriverwith their option typesPowerSyncKyselyOptionsandPowerSyncDialectConfig. Nothing else changes. I did not exportPowerSyncConnection, because the driver creates it and the issue did not ask for it. Happy to add it if you want the full set.This adds public API, so I understand if you would rather keep some of it internal.
Tests. A new
tests/exports.test.tsimports fromsrc/index.ts, the package entry point:main:expected undefined to be type of 'function'.PowerSyncKyselyDatabaseinserts and counts rows. Onmain:Class extends value undefined is not a constructor or null.new Kysely({ dialect: new PowerSyncDialect({ db }) })inserts and selects rows. Onmain:SUT.PowerSyncDialect is not a constructor.All 31 tests in the package pass in Chromium,
attw(test:exports) is green, and the changed files are formatted with the repo's prettier settings. There's a patch changeset for@powersync/kysely-driver.🤖 Generated with Claude Code