@muze-nl/jsfs-solid 0.2.4 → 0.3.0
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/.github/workflows/hugo-build.yaml +73 -0
- package/dist/browser.js +473 -124
- package/dist/browser.js.map +4 -4
- package/dist/browser.min.js +10 -10
- package/dist/browser.min.js.map +4 -4
- package/package.json +2 -2
- package/package.json~ +2 -2
- package/src/SolidAdapter.js +12 -0
- package/src/SolidClient.js +47 -7
- package/src/browser.js +12 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muze-nl/jsfs-solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"author": "auke@muze.nl",
|
|
5
5
|
"source": "src/SolidAdapter.js",
|
|
6
6
|
"main": "src/SolidClient.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@muze-nl/jaqt": "^0.10.6",
|
|
31
31
|
"@muze-nl/jsfs": "^0.3.4",
|
|
32
32
|
"@muze-nl/metro": "^0.6.20",
|
|
33
|
-
"@muze-nl/metro-oidc": "^0.
|
|
33
|
+
"@muze-nl/metro-oidc": "^0.6.0",
|
|
34
34
|
"@muze-nl/metro-oldm": "^0.3.2",
|
|
35
35
|
"@muze-nl/oldm": "^0.5.1"
|
|
36
36
|
}
|
package/package.json~
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muze-nl/jsfs-solid",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"author": "auke@muze.nl",
|
|
5
5
|
"source": "src/SolidAdapter.js",
|
|
6
6
|
"main": "src/SolidClient.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@muze-nl/jaqt": "^0.10.6",
|
|
31
31
|
"@muze-nl/jsfs": "^0.3.4",
|
|
32
32
|
"@muze-nl/metro": "^0.6.20",
|
|
33
|
-
"@muze-nl/metro-oidc": "^0.
|
|
33
|
+
"@muze-nl/metro-oidc": "^0.6.0",
|
|
34
34
|
"@muze-nl/metro-oldm": "^0.3.2",
|
|
35
35
|
"@muze-nl/oldm": "^0.5.1"
|
|
36
36
|
}
|
package/src/SolidAdapter.js
CHANGED
|
@@ -28,6 +28,11 @@ export default class SolidAdapter extends HttpAdapter
|
|
|
28
28
|
return 'SolidAdapter';
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
supportsDirectories()
|
|
32
|
+
{
|
|
33
|
+
return true
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
async read(path)
|
|
32
37
|
{
|
|
33
38
|
let response = await this.#client.get(Path.collapse(path, this.#path));
|
|
@@ -74,4 +79,11 @@ export default class SolidAdapter extends HttpAdapter
|
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|
|
82
|
+
async mkdir(path) {
|
|
83
|
+
this.#client.put(Path.collapse(path, this.#path))
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async rmdir(path) {
|
|
87
|
+
this.#client.delete(Path.collapse(path, this.#path))
|
|
88
|
+
}
|
|
77
89
|
}
|
package/src/SolidClient.js
CHANGED
|
@@ -6,11 +6,51 @@ import '@muze-nl/jaqt'
|
|
|
6
6
|
import '@muze-nl/assert'
|
|
7
7
|
import SolidAdapter from './SolidAdapter.js'
|
|
8
8
|
|
|
9
|
-
export function solidClient(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export default async function solidClient(webid, solidOptions) {
|
|
10
|
+
const defaults = {
|
|
11
|
+
prefixes: {
|
|
12
|
+
'ldp': 'http://www.w3.org/ns/ldp#',
|
|
13
|
+
'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
14
|
+
'dct': 'http://purl.org/dc/terms/',
|
|
15
|
+
'stat': 'http://www.w3.org/ns/posix/stat#',
|
|
16
|
+
'turtle': 'http://www.w3.org/ns/iana/media-types/text/turtle#',
|
|
17
|
+
'schema': 'https://schema.org/',
|
|
18
|
+
'solid': 'http://www.w3.org/ns/solid/terms#',
|
|
19
|
+
'acl': 'http://www.w3.org/ns/auth/acl#',
|
|
20
|
+
'space': 'http://www.w3.org/ns/pim/space#',
|
|
21
|
+
'vcard': 'http://www.w3.org/2006/vcard/ns#',
|
|
22
|
+
'foaf': 'http://xmlns.com/foaf/0.1/'
|
|
23
|
+
},
|
|
24
|
+
parser: n3Parser,
|
|
25
|
+
writer: n3Writer
|
|
26
|
+
}
|
|
27
|
+
const options = Object.assign({}, defaults, solidOptions)
|
|
28
|
+
for (const prefix in defaults.prefixes) {
|
|
29
|
+
if (!info.prefixes[prefix]) {
|
|
30
|
+
info.prefixes[prefix] = defaults.prefixes[prefix]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const profile = await metro.client().with(oldmmw(info), getdatamw()).get(webid)?.primary
|
|
34
|
+
if (!profile || !profile.solid$oidcIssuer) { //FIXME: don't assume $ as the separator
|
|
35
|
+
throw new Error('solidClient: '+webid+' did not return valid solid profile')
|
|
36
|
+
}
|
|
37
|
+
info.issuer = profile.solid$oidcIssuer
|
|
38
|
+
const storage = oldm.many(profile.space$storage)
|
|
39
|
+
.map(s => new jsfs.fs(new SolidAdapter(s, '/', info)))
|
|
14
40
|
|
|
15
|
-
|
|
16
|
-
|
|
41
|
+
return metro.api(
|
|
42
|
+
metro.client(oidcmw(info), oldmmw(info)),
|
|
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
|
+
)
|
|
56
|
+
}
|
package/src/browser.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import '@muze-nl/jsfs'
|
|
2
|
+
import '@muze-nl/metro'
|
|
3
|
+
import '@muze-nl/metro-oidc'
|
|
4
|
+
import '@muze-nl/oldm'
|
|
5
|
+
import '@muze-nl/jaqt'
|
|
6
|
+
import '@muze-nl/assert'
|
|
1
7
|
import SolidAdapter from './SolidAdapter.js'
|
|
8
|
+
import solidClient from './SolidClient.js'
|
|
2
9
|
|
|
3
|
-
export default
|
|
10
|
+
export default {
|
|
11
|
+
adapter: SolidAdapter,
|
|
12
|
+
client: solidClient
|
|
13
|
+
}
|
|
4
14
|
|
|
15
|
+
globalThis.solidClient = solidClient
|
|
5
16
|
globalThis.SolidAdapter = SolidAdapter
|