Skip to content

Conversation

subtleGradient
Copy link
Contributor

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

This PR updates our React Native SQLite client to align with the newer
@op-engineering/op-sqlite API. The prior implementation was valid for older peer
dependency versions; this is a routine refactor plus a dependency floor
adjustment.

  1. API alignment with newer op-sqlite
  • Prior code used an async db.execute and read rows?._array, which belonged
    to older versions. The current API returns results via QueryResult.rows.
  • Updated client to call db.executeSync for the sync path and
    db.executeAsync for the async path, and to consume QueryResult.rows.
  1. TypeScript NodeNext visibility for Sqlite.open
  • Under moduleResolution: "NodeNext", TypeScript omits star re‑exports from
    internal subpaths not exposed in the package exports map, hiding
    open/openSync/openRemote in @op-engineering/op-sqlite types.
  • Added a minimal, temporary ambient module augmentation at
    src/op-sqlite-augmentation.d.ts to surface open and a narrow DB type so
    this package type‑checks in NodeNext environments.

Changes

  • Use executeSync/executeAsync and consume QueryResult.rows
  • Keep value/values helpers aligned with the op-sqlite result shape
  • Add src/op-sqlite-augmentation.d.ts to expose open for NodeNext
  • Document removal plan once upstream publishes a types fix
  • Raise peer dependency lower bound for @op-engineering/op-sqlite to

    = the first version that includes the updated API, so consumers install a
    compatible version by default

Impact

  • Aligns this package with the newer op-sqlite API
  • Improves NodeNext TS ergonomics; no runtime behavior changes
  • Ensures consumers get a compatible op-sqlite version by default

Related

@Copilot Copilot AI review requested due to automatic review settings September 12, 2025 18:55
@github-project-automation github-project-automation bot moved this to Discussion Ongoing in PR Backlog Sep 12, 2025
Copy link

changeset-bot bot commented Sep 12, 2025

🦋 Changeset detected

Latest commit: 03fc278

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

This PR includes changesets to release 1 package
Name Type
@effect/sql-sqlite-react-native Minor

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

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the React Native SQLite client to be compatible with newer versions of @op-engineering/op-sqlite by migrating from the legacy API to the current API structure.

  • Updates method calls from db.execute to db.executeSync/db.executeAsync
  • Changes result access from result.rows?._array to result.rows
  • Raises minimum peer dependency version from 7.1.0 to >=12.0.0

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.

File Description
packages/sql-sqlite-react-native/src/SqliteClient.ts Updates API calls to use current op-sqlite methods and result structure
packages/sql-sqlite-react-native/package.json Raises minimum version requirement for op-sqlite dependency
.changeset/short-lamps-vanish.md Adds changeset entry for the minor version update
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mikearnaldi
Copy link
Member

Can the augmentation be directly in the .ts file? otherwise the file will end up in the final package

Comment on lines +48 to +60
declare module "@op-engineering/op-sqlite" {
export type OPDB = {
close(): void
executeSync(query: string, params?: Array<unknown>): { rows?: Array<unknown> }
executeAsync(query: string, params?: Array<unknown>): Promise<{ rows?: Array<unknown> }>
}

export function open(options: {
name: string
location?: string
encryptionKey?: string
}): OPDB
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ DONE: move temporary declare module into packages/sql-sqlite-react-native/src/SqliteClient.ts
✅ DONE: Land upstream PR: OP-Engineering/op-sqlite#324
☑️ TODO: Release @op-engineering/op-sqlite@^15.0.4 (not blocking this PR)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Discussion Ongoing
Development

Successfully merging this pull request may close these issues.

@effect/sql-sqlite-react-native silently fails with latest op-sqlite
2 participants