-
Notifications
You must be signed in to change notification settings - Fork 1
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
Custom pin function #45
Conversation
How robust is that prepare tooling? Should we move it into core js-tableland? |
I think naming it "prepare" is a bit of a misnomer, and I think I'm going to rename it to "process". So probably not robust for the uses of which you're thinking. Though in the next iteration maybe? I'm actually rethinking JETI's premise. "JavaScript Extension for Tableland and IPFS". Tableland queries with IPFS? Great! But really, it could be even better. And more simple. If we just use a custom import { setup } from '@tableland/sdk';
setup({
processor: (content) => {
return await addContentToIpfsAndReturnCid(content);
}
});
db.prepare(await process`INSERT INTO mytable (id, avatar) values ('1', ${avatar})`).run(); and the Same concept with resolve, except it would be // Custom resolve funtion
resolver(cell) {
if(cell.column==="avatar") {
return await resolveFromIpfs(cell.content);
}
return cell.content;
}
// Elsewhere
resolve(db.prepare("SELECT id, name from table;").all()); |
(In general, I think this would be a nice feature as part of the SDK, too. Uploading data to IPFS and storing CIDs in tables is a core use case.) |
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.
Looks like my approval got wiped when I updated the staging branch. Approving again
By default, JETI uses your local IPFS node and errors out if you don't have a remote pinning service connected. This meant you could only work with the "standardized" IPFS pinning API. But that isn't fully supported everywhere. So if you want to set up your own pin function, you can do that now, like so: