Skip to content
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

Fetch well known solid from root #1604

Merged
merged 5 commits into from
May 11, 2022
Merged

Conversation

matthieubosquet
Copy link
Contributor

This makes fetching the well known solid from the server's root by default.

@matthieubosquet matthieubosquet requested a review from a team as a code owner May 10, 2022 10:55
@vercel
Copy link

vercel bot commented May 10, 2022

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

Name Status Preview Updated
solid-client-js ✅ Ready (Inspect) Visit Preview May 11, 2022 at 10:15AM (UTC)

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 10, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 37c102e:

Sandbox Source
solid-client-sandbox Configuration

@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 10:57 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 10:57 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt 1.1 May 10, 2022 10:57 Inactive
@matthieubosquet matthieubosquet temporarily deployed to NSS May 10, 2022 10:57 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 10:58 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 10:58 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 10:58 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 10:58 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 10:58 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 10:58 Inactive
@vercel vercel bot temporarily deployed to Preview May 10, 2022 10:58 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 11:03 Inactive
Copy link
Contributor

@ThisIsMissEm ThisIsMissEm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick initial review, two questions/concerns

);
// Fetches Pod root well known
mockedFetcher.fetch.mockResolvedValueOnce(
new Response(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we store these responses in variables ahead of time? That or in a fixtures directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather be able to read the tests easily ^^,

).href;
return await getSolidDataset(wellKnownSolidUrl);
} catch (e) {
// In case of error, do nothing and try to discover the .well-known
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth storing this error in case the rootResource isn't found?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed up the commnent of the outer function.
All we know here is the server's root well known solid is not accessible, then we can try the other mechanism, when we're done with it, all we know is neither worked... not which one should have worked... I guess the resource might even not be hosted on a solid server ^^,
So, no, I don't think we need to store the error.

For what it's worth, the behaviour was the same prior (the error was catched and the other mechanism tried out).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I agree with @matthieubosquet: the error that matters is that none of the .well-known discovery mechanism worked as a whole, rather than detailing each failed attempt. This whole thing is implementation-specific anyway, once the discovery mechanism is set at the spec level this will be completely rewritten.

@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 12:34 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 12:34 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt 1.1 May 10, 2022 12:34 Inactive
@matthieubosquet matthieubosquet temporarily deployed to NSS May 10, 2022 12:34 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 12:35 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 12:35 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 12:35 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 12:35 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 15:05 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 15:05 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 15:05 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 15:05 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 15:05 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 15:39 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 15:39 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 15:39 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 15:39 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 10, 2022 15:39 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 10, 2022 15:39 Inactive
@@ -1202,6 +1202,19 @@ export async function getWellKnownSolid(
> = internal_defaultFetchOptions
): Promise<SolidDataset & WithServerResourceInfo> {
const urlString = internal_toIriString(url);

// Try to fetch the well-known solid dataset from the server's root (ESS 2.0 behaviour)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comment out of scope for the current PR, but do you think it would be worth documenting systematically, for each function of the public API, if it is a function built against the Solid spec or a particular implementation ? Something like a custom TSDoc tag for instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom TSDoc tag sounds interesting, but I'm not sure it would be very appropriate inside of functions or how standard it is (a quick search yielded an issue, but nothing on the docs).

I see however that there is an experimental tag that I would recommend using for everything that is not standard. I also think it would be good to tag as alpha everything that is not in a versionned standard (at this point in time everything but Solid Protocol).

Furthermore, the see tag seems appropriate for spec links and the label tag is probably the best fit for implementation specific functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I removed this version pointer for now)

).href;
return await getSolidDataset(wellKnownSolidUrl);
} catch (e) {
// In case of error, do nothing and try to discover the .well-known
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I agree with @matthieubosquet: the error that matters is that none of the .well-known discovery mechanism worked as a whole, rather than detailing each failed attempt. This whole thing is implementation-specific anyway, once the discovery mechanism is set at the spec level this will be completely rewritten.

@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 11, 2022 10:14 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 11, 2022 10:14 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt 1.1 May 11, 2022 10:14 Inactive
@matthieubosquet matthieubosquet temporarily deployed to NSS May 11, 2022 10:14 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 11, 2022 10:15 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 11, 2022 10:15 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 11, 2022 10:15 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 11, 2022 10:15 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 11, 2022 10:15 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Dev-Next May 11, 2022 10:15 Inactive
@vercel vercel bot temporarily deployed to Preview May 11, 2022 10:15 Inactive
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 11, 2022 10:21 Inactive
@matthieubosquet matthieubosquet enabled auto-merge (squash) May 11, 2022 10:22
@matthieubosquet matthieubosquet temporarily deployed to Inrupt Production May 11, 2022 10:23 Inactive
@matthieubosquet matthieubosquet merged commit 8e84e01 into main May 11, 2022
@matthieubosquet matthieubosquet deleted the root-well-known-solid branch May 11, 2022 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants