Skip to content

Push to PRD #232

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

Merged
merged 16 commits into from
Jan 30, 2025
Merged

Push to PRD #232

merged 16 commits into from
Jan 30, 2025

Conversation

bitbeckers
Copy link
Collaborator

  • Expose collections entities
  • Add currency amount to Sales entity
  • geoJSON support and SDK bump
  • Fix allowlist check in MetadataUploader (409 bug)

pheuberger and others added 16 commits January 22, 2025 12:38
This sort function was only built to work with a few very specific types
from the Caching DB. However, it was used on data that wasn't meant for
the caching DB. Namely the Blueprints and perhaps others.

This implements basic sorting for all database types.
Our services are difficult to test at the moment and we don't really
have tests for them. However, when you make changes to the GraphQL
schema and potentially introduce new entities, you'll also alway have to
add code to the services and might go below the thresholds set.

PR #218 is going to address this problem and make the services as well
as some of the GraphQL testable.

This is in anticipation of the next commit which is going to introduce
the collections entity as a top-level entity.
Without this patch the user of our GraphQL endpoints needs to go via
hyperboards to access the collections inside. Another drawback is that
via this query they can only access the hypercert id, so they'll have to
fire a separate query to combine the data.

This patch adds collections as a top level entity and exposes full
hypercert objects as child entities. This also applies to hyperboards as
the standalone collections entity is being reused there too.
The problem right now is that the constants that are loaded from the
environment have an additional name if specified. This additional name
is very confusing if you're presented with the error message

Environment variable Alchemy API key is not set.

This makes you wonder if perhaps you have mistyped the variable name.
It's almost always better to just print the variable name as it is
expected in your .env file. One notable exception is perhaps our Web3Up
proof and secret.

That's why this patch changes the approach of assertExists() to only
deal with environment variables (it's not used in any other way
currently) and have the caller specify the variable name and an optional
hint to help the person stumbling over a missing env var error with
additional context.

The name of assertExists() was renamed to getRequiredEnvVar() to better
reflect what the function is doing. The filename was also renamed to
further support this.
The current test file was testing library code that is already
comprehensively tested. It was also making slow RPC requests and slowed
the test suite down substantially. It requires the Alchemy API key to be
set which is not something that we want, so this patch is doing away
with all superfluous tests and focuses on testing only the code that
we've added around the library call.

Also lowered the coverage thresholds since the EVM client getter is now
mocked and its internals are thus not covered by these tests any longer.
Without this patch the Safe signature verification code will get RPC
URLs for the specified chain id. This in turn will load the Alchemy API
key, which is not relevant for our tests.

This patch mocks all of this away, so that the API key doesn't need to
be present in the environment while running tests.

Also lowered the coverage threshold of functiosn to 52 as mocking
getRpcUrl() doesn't touch the internals of this function. This should be
thoroughly tested in a dedicated test file anyway.
Updates hypercerts SDK with latest version that supports geoJSON
properties in metadata.

Upload the accepted MIME types in the upload middleware to support the
uploading of geoJSON files.
latest beta with formatter fix
…phql

Create `collections` top level entity in GraphQL
…y-amount

feat: expose sales currency amount
reverts a regression introduced in commit
4f6beba where we started checking for
allowlist, instead of metadata.allowlist. We should actually check for
the presence of metadata.allowlist, to prevent the case where the user
specifies both a CID and a json allowlist to the endpoint.
…list

fix: check for presence of metadata.allowlist instead of allowlist
Copy link

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 20.86% (🎯 20%) 858 / 4113
🟢 Statements 20.86% (🎯 20%) 858 / 4113
🟢 Functions 52.85% (🎯 52%) 37 / 70
🟢 Branches 67.96% (🎯 63%) 140 / 206
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/index.ts 0% 0% 0% 0% 1-66
src/controllers/MetadataController.ts 41.37% 72.72% 50% 41.37% 61-73, 116-180, 214-228, 237-244, 261-308
src/middleware/upload.ts 85.41% 100% 50% 85.41% 61-67
src/utils/constants.ts 0% 0% 0% 0% 1-18
src/utils/envVars.ts 0% 0% 0% 0% 1-10
Generated in workflow #40 for commit de2ef0e by the Vitest Coverage Report Action

@Jipperism Jipperism merged commit fd7e468 into main Jan 30, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants