-
-
Notifications
You must be signed in to change notification settings - Fork 415
update op-sqlite for @effect/sql-sqlite-react-native #5500
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
Open
subtleGradient
wants to merge
2
commits into
Effect-TS:main
Choose a base branch
from
subtleGradient:update-sqlite-rn
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@effect/sql-sqlite-react-native": minor | ||
| --- | ||
|
|
||
| update op-sqlite for @effect/sql-sqlite-react-native |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,46 @@ import * as Scope from "effect/Scope" | |
|
|
||
| const ATTR_DB_SYSTEM_NAME = "db.system.name" | ||
|
|
||
| /** | ||
| * Temporary ambient augmentation for `@op-engineering/op-sqlite`. | ||
| * | ||
| * Why this file exists | ||
| * - Under TypeScript `moduleResolution: "NodeNext"`, value exports that come through | ||
| * `export * from './functions'` do not show up in the public type definitions unless | ||
| * that subpath is explicitly listed in the package `exports` map. | ||
| * - In `@op-engineering/[email protected]`, this means `open` (and friends) are | ||
| * available at runtime but are not visible to the type system when doing | ||
| * `import * as Sqlite from '@op-engineering/op-sqlite'`. | ||
| * - Our code calls `Sqlite.open(...)`, which triggers TS2339/TS2305 without this | ||
| * augmentation when using NodeNext. | ||
| * | ||
| * What this does | ||
| * - Minimally augments the module to surface the `open` function and a narrow `OPDB` | ||
| * shape that covers only what we use here (close/executeSync/executeAsync). | ||
| * - This merges with the library’s existing types; it does not replace them. | ||
| * | ||
| * Removal plan | ||
| * - TODO: Remove this file once upstream publishes a fix that explicitly re‑exports | ||
| * these functions in the types entry (see tracking PR below). At that point, | ||
| * `Sqlite.open` should type‑check without any local augmentation. | ||
| * | ||
| * More details | ||
| * - Upstream PR: https://github.com/OP-Engineering/op-sqlite/pull/324 | ||
| */ | ||
| 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 | ||
| } | ||
|
|
||
| /** | ||
| * @category type ids | ||
| * @since 1.0.0 | ||
|
|
@@ -117,11 +157,11 @@ export const make = ( | |
| try: () => db.executeAsync(sql, params as Array<any>), | ||
| catch: (cause) => new SqlError({ cause, message: "Failed to execute statement (async)" }) | ||
| }), | ||
| (result) => result.rows?._array ?? [] | ||
| (result) => result.rows ?? [] | ||
| ) | ||
| } | ||
| return Effect.try({ | ||
| try: () => db.execute(sql, params as Array<any>).rows?._array ?? [], | ||
| try: () => db.executeSync(sql, params as Array<any>).rows ?? [], | ||
| catch: (cause) => new SqlError({ cause, message: "Failed to execute statement" }) | ||
| }) | ||
| }) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ DONE: move temporary
declare moduleinto packages/sql-sqlite-react-native/src/SqliteClient.ts✅ DONE: Land upstream PR: OP-Engineering/op-sqlite#324
✅ DONE: Release
@op-engineering/op-sqlite@^15.0.4https://github.com/OP-Engineering/op-sqlite/releases/tag/15.0.4☑️ TODO: Update the dev deps to @op-engineering/op-sqlite@^15.0.4 and drop the
declare module(not blocking this PR)