-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add artifactUri, thumbnailUri, and displayUri to top level of Objkt #32
base: dev
Are you sure you want to change the base?
Add artifactUri, thumbnailUri, and displayUri to top level of Objkt #32
Conversation
src/Resolver/ObjktResolver.ts
Outdated
}) | ||
thumbnailUri(@Root() objkt: Objkt, @Ctx() ctx: RequestContext) { | ||
if (objkt.thumbnailUri) return objkt.thumbnailUri; | ||
return ctx.genTokLoader.load(objkt.metadata?.thumbnailUri); |
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.
The genTokLoader is a DataLoader designed to batch queries to get a Generative Token from the database. Its load function accepts a Generative Token ID.
Ultimately, requesting the DataLoader in here is not required, as the data is already available in objkt.metadata.thumbnailUri
already stored in memory at this point of execution.
src/Resolver/ObjktResolver.ts
Outdated
}) | ||
displayUri(@Root() objkt: Objkt, @Ctx() ctx: RequestContext) { | ||
if (objkt.displayUri) return objkt.displayUri; | ||
return ctx.genTokLoader.load(objkt.metadata?.displayUri); |
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.
Same remark as thumbnailUri
src/Resolver/ObjktResolver.ts
Outdated
@FieldResolver((returns) => String, { | ||
description: "IPFS uri pointing to the web page hosting the Generator code.", | ||
}) | ||
artifactUri(@Root() objkt: Objkt, @Ctx() ctx: RequestContext) { |
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.
This resolver should be removed as it can be derived from the Generative Token generativeUri
and the objkt generationHash
https://gateway.fxhash.xyz/ipfs/${cid(generativeUri)}/?fxhash=${generationHash}
- Remove artificatUri - Remove Data Loader wrapper for displayUri and thumbnailUri
Addressed PR feedback with latest commit. Thanks for your help here. |
This PR attempts to update
Objkt
to supplyartifactUri
,thumbnailUri
, anddisplayUri
outside of themetadata
field. These are very common fields and nesting them only withinmetadata
is problematic because it requires loading the entiremetadata
field to access them. Metadata can be huge for someObjkt
s because it contains the description of the project and a lot of other data that is not necessarily always needed.I wasn't able to fully test this because I had issues getting the Docker container up and running:
#31
#27