@muze-nl/jsfs-solid 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/jsfs-solid",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "author": "auke@muze.nl",
5
5
  "source": "src/SolidAdapter.js",
6
6
  "main": "src/SolidClient.js",
package/package.json~ CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muze-nl/jsfs-solid",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "author": "auke@muze.nl",
5
5
  "source": "src/SolidAdapter.js",
6
6
  "main": "src/SolidClient.js",
@@ -30,7 +30,8 @@ export default async function solidClient(webid, solidOptions) {
30
30
  options.prefixes[prefix] = defaults.prefixes[prefix]
31
31
  }
32
32
  }
33
- const profile = await metro.client().with(oldmmw(options), metro.mw.getdata()).get(webid)?.primary
33
+ const response = await metro.client(oldmmw(options), metro.mw.getdata()).get(webid)
34
+ const profile = response?.primary
34
35
  if (!profile || !profile.solid$oidcIssuer) { //FIXME: don't assume $ as the separator
35
36
  throw new Error('solidClient: '+webid+' did not return valid solid profile')
36
37
  }
@@ -38,19 +39,20 @@ export default async function solidClient(webid, solidOptions) {
38
39
  const storage = oldm.many(profile.space$storage)
39
40
  .map(s => new jsfs.fs(new SolidAdapter(s, '/', options)))
40
41
 
41
- return metro.api(
42
- metro.client(metro.oidc.oidcmw(options), oldmmw(options)),
43
- {
44
- profile,
45
- issuer: profile.solid$oidcIssuer,
46
- inbox: profile.ldp$inbox,
47
- id: function() {
48
- return metro.oidc.idToken(this.issuer)
49
- },
50
- logout: async function() {
51
- throw new Error('not yet implemented')
52
- },
53
- ...storage
54
- }
55
- )
42
+ const client = metro.client(metro.oidc.oidcmw(options), oldmmw(options))
43
+ Object.assign(client, {
44
+ profile,
45
+ issuer: profile.solid$oidcIssuer,
46
+ inbox: profile.ldp$inbox,
47
+ id: function() {
48
+ return metro.oidc.idToken(this.issuer)
49
+ },
50
+ logout: async function() {
51
+ throw new Error('not yet implemented')
52
+ },
53
+ ...storage
54
+ })
55
+ client.id.bind(client)
56
+ client.logout.bind(client)
57
+ return client
56
58
  }