Skip to content

Conversation

rafaelcr
Copy link
Collaborator

Modifies the AsyncLocalStorage to support one PgSqlClient per database instead of only one globally. Allows clients to connect to multiple DBs simultaneously with independent SQL transaction contexts.

Also adds an unwrap helper function, migrated from the Stacks API repo.

@rafaelcr rafaelcr requested a review from janniks June 23, 2025 17:29
Copy link
Collaborator

@janniks janniks left a comment

Choose a reason for hiding this comment

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

LGTM

* @param onNullish - Callback to throw an error if the value is null or undefined
* @returns The unwrapped value
*/
export function unwrap<T>(val: T | null, onNullish?: () => string): Exclude<T, undefined | null> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice helper, Not used anywhere yet, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's used in the API but defined locally there... once this new release is out we'd update it to use the one defined here

@rafaelcr rafaelcr merged commit 2aa3a47 into master Jun 23, 2025
3 checks passed
@rafaelcr rafaelcr deleted the feat/multiple-async branch June 23, 2025 17:47
hirosystems-release-bot bot added a commit that referenced this pull request Jun 23, 2025
## [1.10.0](v1.9.1...v1.10.0) (2025-06-23)

### Features

* support sql transactions for multiple databases ([#49](#49)) ([2aa3a47](2aa3a47))
@hirosystems-release-bot
Copy link

🎉 This PR is included in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants