js icon indicating copy to clipboard operation
js copied to clipboard

feat(extensions/database): adds database creation and retrieval

Open gregfromstl opened this issue 1 year ago • 7 comments

TL;DR

This PR introduces essential database management functionalities including the ability to create and fetch databases, along with corresponding unit tests.

What changed?

  • Created a new file constants.ts in database extension to hold constant values.
  • Implemented get-databases.ts to fetch databases for a given owner address.
  • Added unit tests for get-databases function.
  • Implemented create-database.ts to allow creation of new databases.
  • Added unit tests for create-database function.

How to test?

  • Run vitest to execute the test cases.
  • Verify that tests cover all possible scenarios mentioned in the implementation.

Why make this change?

These changes are crucial for the database management module to function effectively, enabling users to create and manage their databases programmatically.



PR-Codex overview

This PR adds database functionality to Thirdweb, including creating databases, collections, and retrieving database information.

Detailed summary

  • Added default database factory address
  • Defined field types and statuses
  • Implemented functions to create and get databases/collections
  • Wrote tests for database operations

The following files were skipped due to too many changes: packages/thirdweb/src/extensions/database/write/create-collection.ts, packages/thirdweb/src/extensions/database/read/get-databases.test.ts, packages/thirdweb/src/extensions/database/write/create-database.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

gregfromstl avatar Jul 13 '24 23:07 gregfromstl

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 7:23am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 7:23am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 7:23am

vercel[bot] avatar Jul 13 '24 23:07 vercel[bot]

⚠️ No Changeset found

Latest commit: d79dd53430770afeb6bd3b3b1db9336b7dc29bc9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Jul 13 '24 23:07 changeset-bot[bot]

Your org requires the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

graphite-app[bot] avatar Jul 13 '24 23:07 graphite-app[bot]

  • #3680 Graphite 👈
  • main

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @gregfromstl and the rest of your teammates on Graphite Graphite

gregfromstl avatar Jul 13 '24 23:07 gregfromstl

CodSpeed Performance Report

Merging #3680 will not alter performance

Comparing feat/database-creation (d79dd53) with main (26d825b)

Summary

✅ 9 untouched benchmarks

codspeed-hq[bot] avatar Jul 13 '24 23:07 codspeed-hq[bot]

Codecov Report

Attention: Patch coverage is 97.19222% with 13 lines in your changes missing coverage. Please review.

Project coverage is 61.89%. Comparing base (26d825b) to head (d79dd53).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3680      +/-   ##
==========================================
+ Coverage   61.65%   61.89%   +0.23%     
==========================================
  Files         933      941       +8     
  Lines       73638    74101     +463     
  Branches     3756     3771      +15     
==========================================
+ Hits        45401    45862     +461     
- Misses      27551    27553       +2     
  Partials      686      686              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.66% <ø> (ø) Carriedforward from 26d825b
packages 61.24% <97.19%> (+0.28%) :arrow_up:

*This pull request uses carry forward flags. Click here to find out more.

Files Coverage Δ
...ages/thirdweb/src/extensions/database/constants.ts 100.00% <100.00%> (ø)
...eb/src/extensions/database/read/get-collections.ts 100.00% <100.00%> (ø)
...dweb/src/extensions/database/read/get-databases.ts 100.00% <100.00%> (ø)
packages/thirdweb/src/extensions/database/types.ts 100.00% <100.00%> (ø)
...src/extensions/database/write/create-collection.ts 100.00% <100.00%> (ø)
...b/src/extensions/database/write/create-document.ts 100.00% <100.00%> (ø)
...rdweb/src/extensions/database/read/get-document.ts 94.73% <94.73%> (ø)
...b/src/extensions/database/write/create-database.ts 89.13% <89.13%> (ø)

... and 4 files with indirect coverage changes

codecov[bot] avatar Jul 13 '24 23:07 codecov[bot]

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 43.27 KB (+0.05% 🔺) 866 ms (+0.05% 🔺) 1.5 s (+31.91% 🔺) 2.3 s
thirdweb (cjs) 91.39 KB (0%) 1.9 s (0%) 2.1 s (-4.71% 🔽) 3.9 s
thirdweb (minimal + tree-shaking) 4.82 KB (0%) 97 ms (0%) 228 ms (+510.54% 🔺) 325 ms
thirdweb/chains (tree-shaking) 433 B (0%) 10 ms (0%) 60 ms (+66.8% 🔺) 70 ms
thirdweb/react (minimal + tree-shaking) 13.54 KB (0%) 271 ms (0%) 88 ms (-63.83% 🔽) 358 ms

github-actions[bot] avatar Jul 15 '24 01:07 github-actions[bot]