Hi everyone!
I’m still a bit new to solid, so let me know if this has already been answered
I’ve been working on a project using Inrupt’s solid-client-js
library, and I have a feature where a user can subscribe to services from another user by adding their webId to a list on the second user’s pod. To do this, I’m using the list’s ACL to give the first user append access, but not read access. The list is stored as a ttl file. However, I can’t seem to find a great way to do this with the library.
My code looks something like this:
export const subscribeToUser = async (clientListUrl, myProfile) => {
const {myWebId, myName} = myProfile;
const thing = buildThing(createThing({ name: myName }))
.addUrl(RDF_PREDICATES.identifier, myWebId)
.build();
let dataset = createSolidDataset();
dataset = setThing(dataset, thing);
await saveSolidDatasetAt(clientListUrl, dataset);
};
However, this code attempts to overwrite the existing list, not append to it, and it’s rejected because the user doesn’t have write access.
Inrupt’s docs suggest loading the dataset first with getSolidDataset
, but that’s not possible because the user doesn’t have read access.
I’m able to work around this by using the mockSolidDatasetFrom
function:
export const subscribeToUser = async (clientListUrl, myProfile) => {
...
let dataset = mockSolidDatasetFrom(clientListUrl);
dataset = setThing(dataset, thing);
await saveSolidDatasetAt(datasetUrl, dataset);
};
This method correctly appends the thing, but the docs say not to use mockSolidDatasetFrom
in production.
Has anyone found a good way to do this?